minor tweak to avoid double-notifying ppl

master
Aevann1 2022-10-14 20:35:13 +02:00
parent 423ad25d2a
commit afdec9a5a9
1 changed files with 2 additions and 3 deletions

View File

@ -1216,6 +1216,8 @@ def sticky_post(post_id, v):
post.stickied_utc = int(time.time()) + 3600
pin_time = 'for 1 hour'
code = 200
if v.id != post.author_id:
send_repeatable_notification(post.author_id, f"@{v.username} (Admin) has pinned [{post.title}](/post/{post_id})!")
else:
post.stickied_utc = None
pin_time = 'permanently'
@ -1233,9 +1235,6 @@ def sticky_post(post_id, v):
)
g.db.add(ma)
if v.id != post.author_id:
send_repeatable_notification(post.author_id, f"@{v.username} (Admin) has pinned [{post.title}](/post/{post_id}) {pin_time}!")
cache.delete_memoized(frontlist)
return {"message": f"Post pinned {pin_time}!"}, code