Revert "remove leftover code"

This reverts commit 24fc61fedf.
pull/219/head
Aevann 2023-12-04 15:18:54 +02:00
parent 05ed691083
commit 8483a233c1
1 changed files with 19 additions and 0 deletions

View File

@ -47,6 +47,9 @@ def cron_fn(every_5m, every_1d, every_1mo):
_award_timers_task()
g.db.commit()
_unpin_expired()
g.db.commit()
_grant_one_year_badges()
g.db.commit()
@ -313,6 +316,22 @@ def _award_timers_task():
})
_process_timer(User.flairchanged, [96], "Your temporary flair-lock has expired. You can now change your flair!")
def _unpin_expired():
t = int(time.time())
pins = []
for cls in (Post, Comment):
pins += g.db.query(cls).options(load_only(cls.id)).filter(cls.stickied_utc < t)
for pin in pins:
pin.stickied = None
pin.stickied_utc = None
g.db.add(pin)
if pins:
cache.delete_memoized(frontlist)
def _give_marseybux_salary():
for u in g.db.query(User).filter(User.admin_level > 0).all():
marseybux_salary = u.admin_level * 10000