Skip to content

Commit

Permalink
Fixup. Format code with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions authored and vsabatie committed Nov 22, 2023
1 parent 03087b5 commit 4aedef4
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 33 deletions.
54 changes: 27 additions & 27 deletions pod/main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,55 +310,55 @@

# PWA

PWA_APP_NAME = 'Pod'
PWA_APP_NAME = "Pod"
PWA_APP_DESCRIPTION = _(
"Pod is aimed at users of our institutions, by allowing the publication of "
"videos in the fields of research (promotion of platforms, etc.), training "
"(tutorials, distance training, student reports, etc.), institutional life (video "
"of events), offering several days of content."
)
PWA_APP_THEME_COLOR = '#0A0302'
PWA_APP_BACKGROUND_COLOR = '#ffffff'
PWA_APP_DISPLAY = 'standalone'
PWA_APP_SCOPE = '/'
PWA_APP_ORIENTATION = 'any'
PWA_APP_START_URL = '/'
PWA_APP_STATUS_BAR_COLOR = 'default'
PWA_APP_THEME_COLOR = "#0A0302"
PWA_APP_BACKGROUND_COLOR = "#ffffff"
PWA_APP_DISPLAY = "standalone"
PWA_APP_SCOPE = "/"
PWA_APP_ORIENTATION = "any"
PWA_APP_START_URL = "/"
PWA_APP_STATUS_BAR_COLOR = "default"
PWA_APP_ICONS = [
{
'src': f'/static/img/icon_x{size}.png',
'sizes': f"{size}x{size}",
'purpose': "any maskable",
"src": f"/static/img/icon_x{size}.png",
"sizes": f"{size}x{size}",
"purpose": "any maskable",
}
for size in (1024, 512, 384, 192, 128, 96, 72, 48)
]
PWA_APP_ICONS_APPLE = [
{
'src': f'/static/img/icon_x{size}.png',
'sizes': f"{size}x{size}",
"src": f"/static/img/icon_x{size}.png",
"sizes": f"{size}x{size}",
}
for size in (1024, 512, 384, 192, 128, 96, 72, 48)
]
PWA_APP_SPLASH_SCREEN = [
{
'src': '/static/img/splash-512.png',
'media': (
'(device-width: 320px) '
'and (device-height: 568px) '
'and (-webkit-device-pixel-ratio: 2)'
)
"src": "/static/img/splash-512.png",
"media": (
"(device-width: 320px) "
"and (device-height: 568px) "
"and (-webkit-device-pixel-ratio: 2)"
),
}
]
PWA_APP_DIR = 'ltr'
PWA_APP_LANG = 'fr-FR'
PWA_APP_DIR = "ltr"
PWA_APP_LANG = "fr-FR"
PWA_APP_SCREENSHOTS = [
{
'src': '/static/img/esup-pod.svg',
'sizes': '750x1334',
"type": "image/png"
}
{"src": "/static/img/esup-pod.svg", "sizes": "750x1334", "type": "image/png"}
]
PWA_SERVICE_WORKER_PATH = os.path.join(
BASE_DIR, "progressive_web_app", "static", "js", "serviceworker.js",
BASE_DIR,
"progressive_web_app",
"static",
"js",
"serviceworker.js",
)
PWA_APP_DEBUG_MODE = locals().get("DEBUG", False)
11 changes: 9 additions & 2 deletions pod/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,17 @@ def set_notifications(request):
setNotificationForm = SetNotificationForm(instance=request.user.owner)

if request.method == "POST":
setNotificationForm = SetNotificationForm(request.POST, instance=request.user.owner)
setNotificationForm = SetNotificationForm(
request.POST, instance=request.user.owner
)
if setNotificationForm.is_valid():
setNotificationForm.save()
return JsonResponse({"success": True, "user_accepts_notifications": request.user.owner.accepts_notifications})
return JsonResponse(
{
"success": True,
"user_accepts_notifications": request.user.owner.accepts_notifications,
}
)
else:
messages.add_message(
request,
Expand Down
2 changes: 1 addition & 1 deletion pod/progressive_web_app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.templatetags.static import static


DEFAULT_ICON = static('img/icon_x1024.png')
DEFAULT_ICON = static("img/icon_x1024.png")


def notify_user(user, title, message, url=None, icon=None):
Expand Down
4 changes: 3 additions & 1 deletion pod/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@

# PWA
urlpatterns += [
path("pwa/", include("pod.progressive_web_app.urls", namespace="progressive_web_app")),
path(
"pwa/", include("pod.progressive_web_app.urls", namespace="progressive_web_app")
),
]

# BBB: TODO REPLACE BBB BY MEETING
Expand Down
5 changes: 4 additions & 1 deletion pod/video_encode_transcript/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ def get_encoding_video(video_to_encode):

def end_of_encoding(video):
"""Send mail at the end of encoding, call transcription."""
if video.owner.owner.accepts_notifications and PushInformation.objects.filter(user=video.owner).exists():
if (
video.owner.owner.accepts_notifications
and PushInformation.objects.filter(user=video.owner).exists()
):
send_notification_encoding(video)
elif EMAIL_ON_ENCODING_COMPLETION:
send_email_encoding(video)
Expand Down
7 changes: 6 additions & 1 deletion pod/video_encode_transcript/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,12 @@ def send_notification(video_to_encode, subject_prefix):
"site_title": __TITLE_SITE__,
}

notify_user(video_to_encode.owner, subject, message, url=reverse("video:video", args=(video_to_encode.slug,)))
notify_user(
video_to_encode.owner,
subject,
message,
url=reverse("video:video", args=(video_to_encode.slug,)),
)


def time_to_seconds(a_time):
Expand Down

0 comments on commit 4aedef4

Please sign in to comment.