fix pin awards

pull/49/head
Aevann1 2022-12-05 18:01:13 +02:00
parent ede58dd886
commit b5b3b9dcc3
1 changed files with 9 additions and 7 deletions

View File

@ -238,14 +238,16 @@ def award_thing(v, thing_type, id):
elif kind == "pin":
if not FEATURES['PINS']: abort(403)
if thing.is_banned: abort(403)
if thing.stickied and thing.stickied_utc:
thing.stickied_utc += 3600
if thing_type == 'comment': add = 3600*6
else: add = 3600
if thing.stickied_utc:
thing.stickied_utc += add
else:
thing.stickied = f'{v.username}{PIN_AWARD_TEXT}'
if thing_type == 'comment':
thing.stickied_utc = int(time.time()) + 3600*6
else:
thing.stickied_utc = int(time.time()) + 3600
thing.stickied_utc = int(time.time()) + add
thing.stickied = f'{v.username}{PIN_AWARD_TEXT}'
g.db.add(thing)
cache.delete_memoized(frontlist)
elif kind == "unpin":