black
This commit is contained in:
parent
2b483488aa
commit
440e2f8806
5 changed files with 15 additions and 6 deletions
|
@ -30,7 +30,11 @@ class Book(View):
|
|||
)
|
||||
return ActivitypubResponse(book.to_activity())
|
||||
|
||||
user_statuses = kwargs.get("user_statuses", False) if request.user.is_authenticated else False
|
||||
user_statuses = (
|
||||
kwargs.get("user_statuses", False)
|
||||
if request.user.is_authenticated
|
||||
else False
|
||||
)
|
||||
|
||||
# it's safe to use this OR because edition and work and subclasses of the same
|
||||
# table, so they never have clashing IDs
|
||||
|
|
|
@ -203,6 +203,7 @@ def filter_stream_by_status_type(activities, allowed_types=None):
|
|||
|
||||
return activities
|
||||
|
||||
|
||||
def maybe_redirect_local_path(request, model):
|
||||
"""
|
||||
if the request had an invalid path, return a permanent redirect response to the correct one, including a slug if any.
|
||||
|
@ -211,7 +212,7 @@ def maybe_redirect_local_path(request, model):
|
|||
if request.path == model.local_path:
|
||||
return False
|
||||
|
||||
new_path = model.local_path
|
||||
new_path = model.local_path
|
||||
if len(request.GET) > 0:
|
||||
new_path = f"{model.local_path}?{request.GET.urlencode()}"
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class List(View):
|
|||
return ActivitypubResponse(book_list.to_activity(**request.GET))
|
||||
|
||||
if r := maybe_redirect_local_path(request, book_list):
|
||||
return r;
|
||||
return r
|
||||
|
||||
query = request.GET.get("q")
|
||||
suggestions = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue