diff --git a/files/classes/user.py b/files/classes/user.py index 7913f0b412..f3052dbfcd 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -495,6 +495,84 @@ class User(Base): @property @lazy def profile_url(self): + if self.patron_utc and self.patron_utc < time.time(): + self.patron = 0 + self.patron_utc = 0 + send_repeatable_notification(self.id, "Your paypig status has expired!") + if self.discord_id: remove_role(v, "1") + g.db.add(self) + g.db.commit() + + if self.unban_utc and self.unban_utc < time.time(): + self.is_banned = 0 + self.unban_utc = 0 + self.ban_evade = 0 + send_repeatable_notification(self.id, "You have been unbanned!") + g.db.add(self) + g.db.commit() + + if self.agendaposter and self.agendaposter < time.time(): + self.agendaposter = 0 + send_repeatable_notification(self.id, "Your chud theme has expired!") + g.db.add(self) + badge = self.has_badge(28) + if badge: g.db.delete(badge) + g.db.commit() + + if self.flairchanged and self.flairchanged < time.time(): + self.flairchanged = None + send_repeatable_notification(self.id, "Your flair lock has expired. You can now change your flair!") + g.db.add(self) + badge = self.has_badge(96) + if badge: g.db.delete(badge) + g.db.commit() + + if self.marseyawarded and self.marseyawarded < time.time(): + self.marseyawarded = None + send_repeatable_notification(self.id, "Your marsey award has expired!") + g.db.add(self) + badge = self.has_badge(98) + if badge: g.db.delete(badge) + g.db.commit() + + if self.longpost and self.longpost < time.time(): + self.longpost = None + send_repeatable_notification(self.id, "Your pizzashill award has expired!") + g.db.add(self) + badge = self.has_badge(97) + if badge: g.db.delete(badge) + g.db.commit() + + if self.bird and self.bird < time.time(): + self.bird = None + send_repeatable_notification(self.id, "Your bird site award has expired!") + g.db.add(self) + badge = self.has_badge(95) + if badge: g.db.delete(badge) + g.db.commit() + + if self.progressivestack and self.progressivestack < time.time(): + self.progressivestack = None + send_repeatable_notification(self.id, "Your progressive stack has expired!") + g.db.add(self) + badge = self.has_badge(94) + if badge: g.db.delete(badge) + g.db.commit() + + if self.rehab and self.rehab < time.time(): + self.rehab = None + send_repeatable_notification(self.id, "Your rehab has finished!") + g.db.add(self) + badge = self.has_badge(109) + if badge: g.db.delete(badge) + g.db.commit() + + if self.deflector and self.deflector < time.time(): + self.deflector = None + send_repeatable_notification(self.id, "Your deflector has expired!") + g.db.add(self) + g.db.commit() + if self.agendaposter: return f"{SITE_FULL}/assets/images/astolfo.webp?v=1" if self.profileurl: if self.profileurl.startswith('/'): return SITE_FULL + self.profileurl diff --git a/files/routes/front.py b/files/routes/front.py index 23c09d632c..9ad46b910c 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -209,87 +209,7 @@ def front_all(v, sub=None, subdomain=None): posts = get_posts(ids, v=v) - if v: - if v.hidevotedon: posts = [x for x in posts if not hasattr(x, 'voted') or not x.voted] - - - if v.patron_utc and v.patron_utc < time.time(): - v.patron = 0 - v.patron_utc = 0 - send_repeatable_notification(v.id, "Your paypig status has expired!") - if v.discord_id: remove_role(v, "1") - g.db.add(v) - g.db.commit() - - if v.unban_utc and v.unban_utc < time.time(): - v.is_banned = 0 - v.unban_utc = 0 - v.ban_evade = 0 - send_repeatable_notification(v.id, "You have been unbanned!") - g.db.add(v) - g.db.commit() - - if v.agendaposter and v.agendaposter < time.time(): - v.agendaposter = 0 - send_repeatable_notification(v.id, "Your chud theme has expired!") - g.db.add(v) - badge = v.has_badge(28) - if badge: g.db.delete(badge) - g.db.commit() - - if v.flairchanged and v.flairchanged < time.time(): - v.flairchanged = None - send_repeatable_notification(v.id, "Your flair lock has expired. You can now change your flair!") - g.db.add(v) - badge = v.has_badge(96) - if badge: g.db.delete(badge) - g.db.commit() - - if v.marseyawarded and v.marseyawarded < time.time(): - v.marseyawarded = None - send_repeatable_notification(v.id, "Your marsey award has expired!") - g.db.add(v) - badge = v.has_badge(98) - if badge: g.db.delete(badge) - g.db.commit() - - if v.longpost and v.longpost < time.time(): - v.longpost = None - send_repeatable_notification(v.id, "Your pizzashill award has expired!") - g.db.add(v) - badge = v.has_badge(97) - if badge: g.db.delete(badge) - g.db.commit() - - if v.bird and v.bird < time.time(): - v.bird = None - send_repeatable_notification(v.id, "Your bird site award has expired!") - g.db.add(v) - badge = v.has_badge(95) - if badge: g.db.delete(badge) - g.db.commit() - - if v.progressivestack and v.progressivestack < time.time(): - v.progressivestack = None - send_repeatable_notification(v.id, "Your progressive stack has expired!") - g.db.add(v) - badge = v.has_badge(94) - if badge: g.db.delete(badge) - g.db.commit() - - if v.rehab and v.rehab < time.time(): - v.rehab = None - send_repeatable_notification(v.id, "Your rehab has finished!") - g.db.add(v) - badge = v.has_badge(109) - if badge: g.db.delete(badge) - g.db.commit() - - if v.deflector and v.deflector < time.time(): - v.deflector = None - send_repeatable_notification(v.id, "Your deflector has expired!") - g.db.add(v) - g.db.commit() + if v and v.hidevotedon: posts = [x for x in posts if not hasattr(x, 'voted') or not x.voted] if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists} return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page, ccmode=ccmode, sub=sub, home=True)