forked from rDrama/rDrama
Add set/unset nsfw on comment to modlog.
parent
75758dd511
commit
e32a4bda48
|
@ -339,6 +339,11 @@ ACTIONTYPES = {
|
||||||
"icon": 'fa-eye-evil',
|
"icon": 'fa-eye-evil',
|
||||||
"color": 'bg-danger'
|
"color": 'bg-danger'
|
||||||
},
|
},
|
||||||
|
'set_nsfw_comment': {
|
||||||
|
"str": 'set nsfw on a {self.target_link}',
|
||||||
|
"icon": 'fa-eye-evil',
|
||||||
|
"color": 'bg-danger'
|
||||||
|
},
|
||||||
'shadowban': {
|
'shadowban': {
|
||||||
"str": 'shadowbanned {self.target_link}',
|
"str": 'shadowbanned {self.target_link}',
|
||||||
"icon": 'fa-eye-slash',
|
"icon": 'fa-eye-slash',
|
||||||
|
@ -404,6 +409,11 @@ ACTIONTYPES = {
|
||||||
"icon": 'fa-eye-evil',
|
"icon": 'fa-eye-evil',
|
||||||
"color": 'bg-success'
|
"color": 'bg-success'
|
||||||
},
|
},
|
||||||
|
'unset_nsfw_comment': {
|
||||||
|
"str": 'un-set nsfw on a {self.target_link}',
|
||||||
|
"icon": 'fa-eye-evil',
|
||||||
|
"color": 'bg-success'
|
||||||
|
},
|
||||||
'unshadowban': {
|
'unshadowban': {
|
||||||
"str": 'unshadowbanned {self.target_link}',
|
"str": 'unshadowbanned {self.target_link}',
|
||||||
"icon": 'fa-eye',
|
"icon": 'fa-eye',
|
||||||
|
|
|
@ -1434,12 +1434,21 @@ def undelete_post_pid(pid, v):
|
||||||
@app.post("/toggle_comment_nsfw/<cid>")
|
@app.post("/toggle_comment_nsfw/<cid>")
|
||||||
@auth_required
|
@auth_required
|
||||||
def toggle_comment_nsfw(cid, v):
|
def toggle_comment_nsfw(cid, v):
|
||||||
|
|
||||||
comment = g.db.query(Comment).filter_by(id=cid).one_or_none()
|
comment = g.db.query(Comment).filter_by(id=cid).one_or_none()
|
||||||
if comment.author_id != v.id and not v.admin_level > 1: abort(403)
|
|
||||||
|
if comment.author_id != v.id and not v.admin_level > 1:
|
||||||
|
abort(403)
|
||||||
|
|
||||||
comment.over_18 = not comment.over_18
|
comment.over_18 = not comment.over_18
|
||||||
g.db.add(comment)
|
g.db.add(comment)
|
||||||
|
|
||||||
|
if comment.author_id != v.id:
|
||||||
|
ma = ModAction(
|
||||||
|
kind = "set_nsfw_comment" if comment.over_18 else "unset_nsfw_comment",
|
||||||
|
user_id = v.id,
|
||||||
|
target_comment_id = comment.id,
|
||||||
|
)
|
||||||
|
g.db.add(ma)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if comment.over_18: return {"message": "Comment has been marked as +18!"}
|
if comment.over_18: return {"message": "Comment has been marked as +18!"}
|
||||||
|
@ -1448,7 +1457,6 @@ def toggle_comment_nsfw(cid, v):
|
||||||
@app.post("/toggle_post_nsfw/<pid>")
|
@app.post("/toggle_post_nsfw/<pid>")
|
||||||
@auth_required
|
@auth_required
|
||||||
def toggle_post_nsfw(pid, v):
|
def toggle_post_nsfw(pid, v):
|
||||||
|
|
||||||
post = get_post(pid)
|
post = get_post(pid)
|
||||||
|
|
||||||
if post.author_id != v.id and not v.admin_level > 1:
|
if post.author_id != v.id and not v.admin_level > 1:
|
||||||
|
@ -1464,7 +1472,6 @@ def toggle_post_nsfw(pid, v):
|
||||||
target_submission_id = post.id,
|
target_submission_id = post.id,
|
||||||
)
|
)
|
||||||
g.db.add(ma)
|
g.db.add(ma)
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if post.over_18: return {"message": "Post has been marked as +18!"}
|
if post.over_18: return {"message": "Post has been marked as +18!"}
|
||||||
|
|
Loading…
Reference in New Issue