Filter out reports from permabanned users.
This commit is contained in:
parent
143eb36aaa
commit
e9ca6e3239
1 changed files with 13 additions and 6 deletions
|
@ -27,6 +27,9 @@ def api_flag_post(pid, v):
|
|||
else:
|
||||
flag = Flag(post_id=post.id, user_id=v.id, reason=reason)
|
||||
g.db.add(flag)
|
||||
|
||||
# We only want to notify if the user is not permabanned
|
||||
if not v.is_suspended_permanently:
|
||||
g.db.query(Submission) \
|
||||
.where(Submission.id == post.id, Submission.filter_state != 'ignored') \
|
||||
.update({Submission.filter_state: 'reported'})
|
||||
|
@ -46,9 +49,13 @@ def api_flag_comment(cid, v):
|
|||
|
||||
flag = CommentFlag(comment_id=comment.id, user_id=v.id, reason=reason)
|
||||
g.db.add(flag)
|
||||
|
||||
# We only want to notify if the user is not permabanned
|
||||
if not v.is_suspended_permanently:
|
||||
g.db.query(Comment) \
|
||||
.where(Comment.id == comment.id, Comment.filter_state != 'ignored') \
|
||||
.update({Comment.filter_state: 'reported'})
|
||||
|
||||
g.db.commit()
|
||||
|
||||
return {"message": "Comment reported!"}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue