From 0da9c36a079d08673822d5ecbf72a5a810e8a5d5 Mon Sep 17 00:00:00 2001 From: BuckFromRdrama <98723184+BuckFromRdrama@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:33:25 -0500 Subject: [PATCH] Show modded subs on userpage (#205) * show modded subs * remove print lol * added links --- files/classes/sub.py | 2 ++ files/classes/user.py | 6 ++++++ files/templates/userpage.html | 11 +++++++++++ 3 files changed, 19 insertions(+) diff --git a/files/classes/sub.py b/files/classes/sub.py index 852decaa32..c919a7b0ec 100644 --- a/files/classes/sub.py +++ b/files/classes/sub.py @@ -1,3 +1,5 @@ +SITE_FULL = "" + from sqlalchemy import * from files.__main__ import Base from files.helpers.lazy import lazy diff --git a/files/classes/user.py b/files/classes/user.py index 3c88a2557d..9bc7e9defb 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -435,6 +435,12 @@ class User(Base): return output + @property + @lazy + def moderated_subs(self): + modded_subs = g.db.query(Mod.sub).filter_by(user_id=self.id).all() + return modded_subs + def has_follower(self, user): return g.db.query(Follow).filter_by(target_id=self.id, user_id=user.id).one_or_none() diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 0147f2cd4b..6c58ac28b4 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -149,6 +149,17 @@ {% endif %} + {% if u.moderated_subs %} +
Moderator of
+ {% for a in u.moderated_subs %} + + /s/x{{a['sub']}} + + {% endfor %} +