From afdec9a5a9a8d7b4cce9c042291de2a7418f7b69 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 14 Oct 2022 20:35:13 +0200 Subject: [PATCH] minor tweak to avoid double-notifying ppl --- files/routes/admin.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 95f14d5a3..c3296028c 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -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