mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 08:36:32 +00:00
Python formatting
This commit is contained in:
parent
e5c8500547
commit
191079a922
2 changed files with 10 additions and 8 deletions
|
@ -47,7 +47,9 @@ urlpatterns = [
|
|||
re_path(r"^ostatus_subscribe/?$", views.ostatus_follow_request),
|
||||
# polling updates
|
||||
re_path("^api/updates/notifications/?$", views.get_notification_count),
|
||||
re_path("^api/updates/stream/(?P<stream>[a-z]+)/?$", views.get_unread_status_string),
|
||||
re_path(
|
||||
"^api/updates/stream/(?P<stream>[a-z]+)/?$", views.get_unread_status_string
|
||||
),
|
||||
# authentication
|
||||
re_path(r"^login/?$", views.Login.as_view(), name="login"),
|
||||
re_path(r"^login/(?P<confirmed>confirmed)/?$", views.Login.as_view(), name="login"),
|
||||
|
|
|
@ -33,14 +33,14 @@ def get_unread_status_string(request, stream="home"):
|
|||
allowed_status_types = request.user.feed_status_types
|
||||
count = sum(c for (k, c) in counts_by_type if k in allowed_status_types)
|
||||
# if "everything else" is allowed, add other types to the sum
|
||||
count += sum(c for (k, c) in counts_by_type if k not in ["review", "comment", "quotation"])
|
||||
count += sum(
|
||||
c
|
||||
for (k, c) in counts_by_type
|
||||
if k not in ["review", "comment", "quotation"]
|
||||
)
|
||||
|
||||
translation_string = lambda c: ngettext(
|
||||
"Load %(count)d unread status",
|
||||
"Load %(count)d unread statuses",
|
||||
c
|
||||
"Load %(count)d unread status", "Load %(count)d unread statuses", c
|
||||
) % {"count": c}
|
||||
|
||||
return JsonResponse(
|
||||
{"total": translation_string(count)}
|
||||
)
|
||||
return JsonResponse({"total": translation_string(count)})
|
||||
|
|
Loading…
Reference in a new issue