From 5b021432a47137f12aa7fa9fcdc55471a58543be Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 8 Jul 2023 16:33:12 +0300 Subject: [PATCH] in json, return author_id and ids of replies --- files/classes/comment.py | 3 ++- files/classes/post.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index cfafbd530..eec116ebc 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -287,6 +287,7 @@ class Comment(Base): data = { 'id': self.id, 'level': self.level, + 'author_id': '👻' if self.ghost else self.author_id, 'author_name': self.author_name, 'body': self.body, 'body_html': self.body_html, @@ -305,7 +306,7 @@ class Comment(Base): 'downvotes': self.downvotes, 'is_bot': self.is_bot, 'reports': reports, - # 'replies': [x.json for x in self.replies(sort="old", v=None)] # WORKER TIMEOUTS ON BUGTHREAD + 'replies': [x.id for x in self.replies(sort="old")] } if self.level >= 2: data['parent_comment_id'] = self.parent_comment_id diff --git a/files/classes/post.py b/files/classes/post.py index d81129a4d..3604a6a03 100644 --- a/files/classes/post.py +++ b/files/classes/post.py @@ -208,7 +208,9 @@ class Post(Base): for r in self.reports: reports[r.user.username] = r.reason - data = {'author_name': self.author_name, + data = { + 'author_id': '👻' if self.ghost else self.author_id, + 'author_name': self.author_name, 'permalink': self.permalink, 'shortlink': self.shortlink, 'is_banned': bool(self.is_banned), @@ -237,7 +239,7 @@ class Post(Base): } if "replies" in self.__dict__: - data["replies"]=[x.json for x in self.replies] + data["replies"] = [x.json for x in self.replies] return data