in json, return author_id and ids of replies

pull/168/head
Aevann 2023-07-08 16:33:12 +03:00
parent fca27c37eb
commit 5b021432a4
2 changed files with 6 additions and 3 deletions

View File

@ -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

View File

@ -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