From 886dec3ffd26d7d789cbfc4b6ace195dafc09304 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 2 Sep 2023 22:45:50 +0100 Subject: [PATCH] Fix crash on unauthenticated user --- app/blueprints/threads/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/blueprints/threads/__init__.py b/app/blueprints/threads/__init__.py index 56a5ec18..83d4c27b 100644 --- a/app/blueprints/threads/__init__.py +++ b/app/blueprints/threads/__init__.py @@ -398,7 +398,7 @@ def user_comments(username): # Filter replies the current user can see query = ThreadReply.query.options(selectinload(ThreadReply.thread)).filter_by(author=user) if current_user != user and not (current_user.is_authenticated and current_user.rank.at_least(UserRank.APPROVER)): - if user.username == "ContentDB": + if user.username == "ContentDB" or not current_user.is_authenticated: # The ContentDB user simply has too many comments, don't bother checking more than thread privacy query = query.filter(ThreadReply.thread.has(private=False)) else: