Fix: Mod-only information leaked via the API. (#696)
This commit is contained in:
parent
41497958b6
commit
75edfe8b31
3 changed files with 10 additions and 15 deletions
|
@ -213,9 +213,6 @@ class Comment(CreatedBase):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def json_raw(self):
|
def json_raw(self):
|
||||||
flags = {}
|
|
||||||
for f in self.flags(None): flags[f.user.username] = f.reason
|
|
||||||
|
|
||||||
data= {
|
data= {
|
||||||
'id': self.id,
|
'id': self.id,
|
||||||
'level': self.level,
|
'level': self.level,
|
||||||
|
@ -230,12 +227,13 @@ class Comment(CreatedBase):
|
||||||
'is_pinned': self.is_pinned,
|
'is_pinned': self.is_pinned,
|
||||||
'distinguish_level': self.distinguish_level,
|
'distinguish_level': self.distinguish_level,
|
||||||
'post_id': self.post.id if self.post else 0,
|
'post_id': self.post.id if self.post else 0,
|
||||||
'score': self.score,
|
|
||||||
'upvotes': self.upvotes,
|
|
||||||
'downvotes': self.downvotes,
|
|
||||||
'is_bot': self.is_bot,
|
'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
|
return data
|
||||||
|
|
||||||
|
|
|
@ -222,9 +222,6 @@ class Submission(CreatedBase):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def json_raw(self):
|
def json_raw(self):
|
||||||
flags = {}
|
|
||||||
for f in self.flags(None): flags[f.user.username] = f.reason
|
|
||||||
|
|
||||||
data = {'author_name': self.author_name if self.author else '',
|
data = {'author_name': self.author_name if self.author else '',
|
||||||
'permalink': self.permalink,
|
'permalink': self.permalink,
|
||||||
'shortlink': self.shortlink,
|
'shortlink': self.shortlink,
|
||||||
|
@ -241,15 +238,16 @@ class Submission(CreatedBase):
|
||||||
'created_utc': self.created_utc,
|
'created_utc': self.created_utc,
|
||||||
'edited_utc': self.edited_utc or 0,
|
'edited_utc': self.edited_utc or 0,
|
||||||
'comment_count': self.comment_count,
|
'comment_count': self.comment_count,
|
||||||
'score': self.score,
|
|
||||||
'upvotes': self.upvotes,
|
|
||||||
'downvotes': self.downvotes,
|
|
||||||
'stickied': self.stickied,
|
'stickied': self.stickied,
|
||||||
'private' : self.private,
|
'private' : self.private,
|
||||||
'distinguish_level': self.distinguish_level,
|
'distinguish_level': self.distinguish_level,
|
||||||
'voted': self.voted if hasattr(self, 'voted') else 0,
|
'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
|
return data
|
||||||
|
|
||||||
|
|
|
@ -519,7 +519,6 @@ class User(CreatedBase):
|
||||||
data = self.json_core
|
data = self.json_core
|
||||||
|
|
||||||
data["badges"] = [x.json for x in self.badges]
|
data["badges"] = [x.json for x in self.badges]
|
||||||
data['coins'] = self.coins
|
|
||||||
data['post_count'] = self.post_count
|
data['post_count'] = self.post_count
|
||||||
data['comment_count'] = self.comment_count
|
data['comment_count'] = self.comment_count
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue