diff --git a/app/post/routes.py b/app/post/routes.py index 8ba7f3d3..b26ad467 100644 --- a/app/post/routes.py +++ b/app/post/routes.py @@ -29,8 +29,10 @@ def show_post(post_id: int): if community.banned: abort(404) + sort = request.args.get('sort', 'top') + # If nothing has changed since their last visit, return HTTP 304 - current_etag = f"{post.id}_{hash(post.last_active)}" + current_etag = f"{post.id}{sort}_{hash(post.last_active)}" if current_user.is_anonymous and request_etag_matches(current_etag): return return_304(current_etag) @@ -165,7 +167,7 @@ def show_post(post_id: int): return redirect(url_for('activitypub.post_ap', post_id=post_id)) # redirect to current page to avoid refresh resubmitting the form else: - replies = post_replies(post.id, 'top') + replies = post_replies(post.id, sort) form.notify_author.data = True og_image = post.image.source_url if post.image_id else None diff --git a/app/templates/post/post.html b/app/templates/post/post.html index 9810d7c7..4128708c 100644 --- a/app/templates/post/post.html +++ b/app/templates/post/post.html @@ -44,8 +44,19 @@

{{ _('Comments are disabled.') }}

{% endif %} {% if replies %} -
+
+ {% macro render_comment(comment) %}