forked from MarseyWorld/MarseyWorld
fix this
"if a user pins a comment on their wall, then that comment gets janny-removed or the account shadowbanned, the wall owner is unable to pin another comment"master
parent
885414270b
commit
584da46d22
|
@ -1612,6 +1612,11 @@ def remove_comment(c_id, v):
|
||||||
|
|
||||||
comment.is_banned = True
|
comment.is_banned = True
|
||||||
|
|
||||||
|
if comment.pinned:
|
||||||
|
comment.pinned = None
|
||||||
|
comment.pinned_utc = None
|
||||||
|
comment.unpin_parents()
|
||||||
|
|
||||||
for media_usage in comment.media_usages:
|
for media_usage in comment.media_usages:
|
||||||
media_usage.removed_utc = time.time()
|
media_usage.removed_utc = time.time()
|
||||||
g.db.add(media_usage)
|
g.db.add(media_usage)
|
||||||
|
|
|
@ -550,9 +550,10 @@ def pin_comment_wall_owner(cid, v):
|
||||||
if v.id != comment.wall_user_id:
|
if v.id != comment.wall_user_id:
|
||||||
stop(403, "You can't pin comments on the walls of other users!")
|
stop(403, "You can't pin comments on the walls of other users!")
|
||||||
|
|
||||||
existing = g.db.query(Comment.id).filter(
|
existing = g.db.query(Comment.id).join(Comment.author).filter(
|
||||||
Comment.wall_user_id == v.id,
|
Comment.wall_user_id == v.id,
|
||||||
Comment.pinned.like('% (Wall Owner)'),
|
Comment.pinned.like('% (Wall Owner)'),
|
||||||
|
User.shadowbanned == None,
|
||||||
).one_or_none()
|
).one_or_none()
|
||||||
|
|
||||||
if existing:
|
if existing:
|
||||||
|
|
Loading…
Reference in New Issue