Fix: Mod-only information leaked via the API.

This commit is contained in:
Ben Rog-Wilhelm 2023-09-04 22:11:52 -05:00
parent 41497958b6
commit 9f760adb94
2 changed files with 10 additions and 8 deletions

View file

@ -230,12 +230,13 @@ class Comment(CreatedBase):
'is_pinned': self.is_pinned,
'distinguish_level': self.distinguish_level,
'post_id': self.post.id if self.post else 0,
'score': self.score,
'upvotes': self.upvotes,
'downvotes': self.downvotes,
'is_bot': self.is_bot,
'flags': flags,
}
if not self.should_hide_score:
data['score'] = self.score
data['upvotes'] = self.upvotes
data['downvotes'] = self.downvotes
return data

View file

@ -241,15 +241,16 @@ class Submission(CreatedBase):
'created_utc': self.created_utc,
'edited_utc': self.edited_utc or 0,
'comment_count': self.comment_count,
'score': self.score,
'upvotes': self.upvotes,
'downvotes': self.downvotes,
'stickied': self.stickied,
'private' : self.private,
'distinguish_level': self.distinguish_level,
'voted': self.voted if hasattr(self, 'voted') else 0,
'flags': flags,
}
if not self.should_hide_score:
data['score'] = self.score
data['upvotes'] = self.upvotes
data['downvotes'] = self.downvotes
return data