make sure to wipe stickied_utc too

pull/211/head
Aevann 2023-09-29 04:24:36 +03:00
parent e9ee73ec3d
commit 8e27789847
5 changed files with 8 additions and 0 deletions

View File

@ -214,6 +214,7 @@ def _delete_all_posts():
p.deleted_utc = int(time.time())
p.is_pinned = False
p.stickied = None
p.stickied_utc = None
g.db.add(p)
cache.delete_memoized(frontlist)

View File

@ -1345,8 +1345,11 @@ def remove_post(post_id, v):
post = get_post(post_id)
post.is_banned = True
post.is_approved = None
if not FEATURES['AWARDS'] or not post.stickied or not post.stickied.endswith(PIN_AWARD_TEXT):
post.stickied = None
post.stickied_utc = None
post.is_pinned = False
post.ban_reason = v.username
g.db.add(post)
@ -1569,6 +1572,7 @@ def unsticky_comment(cid, v):
abort(403, "Can't unpin award pins!")
comment.stickied = None
comment.stickied_utc = None
g.db.add(comment)
ma=ModAction(

View File

@ -533,6 +533,7 @@ def unpin_comment(cid, v):
abort(403, "You can only unpin comments you have pinned!")
comment.stickied = None
comment.stickied_utc = None
g.db.add(comment)
if v.id != comment.author_id:

View File

@ -722,6 +722,7 @@ def delete_post_pid(pid, v):
p.deleted_utc = int(time.time())
p.is_pinned = False
p.stickied = None
p.stickied_utc = None
g.db.add(p)

View File

@ -824,6 +824,7 @@ def unpin_comment_mod(cid, v):
if not (comment.post.sub and v.mods(comment.post.sub)): abort(403)
comment.stickied = None
comment.stickied_utc = None
g.db.add(comment)
ma = SubAction(