From f9d1df54bf7edbdcc975d30698e90f97d75956ae Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 23 Sep 2022 16:41:56 +0200 Subject: [PATCH] make pin and unpin award work on a basic of 6 hours (unlike posts which is 1 hour) --- files/routes/awards.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/files/routes/awards.py b/files/routes/awards.py index df1490c43..ee67da8c9 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -267,12 +267,20 @@ def award_thing(v, thing_type, id): thing.stickied_utc += 3600 else: thing.stickied = f'{v.username} (pin award)' - thing.stickied_utc = int(time.time()) + 3600 + if thing_type == 'comment': + thing.stickied_utc = int(time.time()) + 3600*6 + else: + thing.stickied_utc = int(time.time()) + 3600 g.db.add(thing) cache.delete_memoized(frontlist) elif kind == "unpin": if not thing.stickied_utc: abort(403) - t = thing.stickied_utc - 3600 + + if thing_type == 'comment': + t = thing.stickied_utc - 3600*6 + else: + t = thing.stickied_utc - 3600 + if time.time() > t: thing.stickied = None thing.stickied_utc = None