From 98b6cc7f22e52e382039bca004c9a302f8b5e31e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 14 Dec 2021 20:35:56 +0200 Subject: [PATCH] sdfsfd --- files/classes/comment.py | 4 ++-- files/routes/front.py | 1 + files/routes/search.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 628f8b8335..5040df5a1e 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -265,14 +265,14 @@ class Comment(Base): data= {'is_banned': True, 'ban_reason': self.ban_reason, 'id': self.id, - 'post': self.post.id, + 'post': self.post.id if self.post else 0, 'level': self.level, 'parent': self.parent_fullname } elif self.deleted_utc > 0: data= {'deleted_utc': self.deleted_utc, 'id': self.id, - 'post': self.post.id, + 'post': self.post.id if self.post else 0, 'level': self.level, 'parent': self.parent_fullname } diff --git a/files/routes/front.py b/files/routes/front.py index 01d8d8881b..d03e257b73 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -105,6 +105,7 @@ def notifications(v): if c not in listing: listing.append(c) + if request.headers.get("Authorization"): return {"data":[x.json for x in listing]} return render_template("notifications.html", v=v, diff --git a/files/routes/search.py b/files/routes/search.py index 76ea5272a0..a0f0b51e5b 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -249,7 +249,7 @@ def searchcomments(v): comments = get_comments(ids, v=v) - if request.headers.get("Authorization"): return [x.json for x in comments] + if request.headers.get("Authorization"): return {"data":[x.json for x in comments]} else: return render_template("search_comments.html", v=v, query=query, total=total, page=page, comments=comments, sort=sort, t=t, next_exists=next_exists)