forked from rDrama/rDrama
make pin and unpin award work on a basic of 6 hours (unlike posts which is 1 hour)
parent
bb4e21b2f0
commit
f9d1df54bf
|
@ -267,12 +267,20 @@ def award_thing(v, thing_type, id):
|
||||||
thing.stickied_utc += 3600
|
thing.stickied_utc += 3600
|
||||||
else:
|
else:
|
||||||
thing.stickied = f'{v.username} (pin award)'
|
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)
|
g.db.add(thing)
|
||||||
cache.delete_memoized(frontlist)
|
cache.delete_memoized(frontlist)
|
||||||
elif kind == "unpin":
|
elif kind == "unpin":
|
||||||
if not thing.stickied_utc: abort(403)
|
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:
|
if time.time() > t:
|
||||||
thing.stickied = None
|
thing.stickied = None
|
||||||
thing.stickied_utc = None
|
thing.stickied_utc = None
|
||||||
|
|
Loading…
Reference in New Issue