Show modded subs on userpage (#205)

* show modded subs

* remove print lol

* added links
remotes/1693045480750635534/spooky-22
BuckFromRdrama 2022-02-11 18:33:25 -05:00 committed by GitHub
parent 97febe0080
commit 0da9c36a07
3 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,5 @@
SITE_FULL = ""
from sqlalchemy import *
from files.__main__ import Base
from files.helpers.lazy import lazy

View File

@ -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()

View File

@ -149,6 +149,17 @@
</div>
{% endif %}
{% if u.moderated_subs %}
<div class="text-white rounded p-2 mb-3" style="background-color: rgba(50, 50, 50, 0.6); width: 30%;">
<p class="text-uppercase my-0" style="font-weight: bold; font-size: 12px;">Moderator of</p>
{% for a in u.moderated_subs %}
<span class="d-inline-block mx-1">
<a href="{{site_full}}/s/{{a['sub']}}">/s/x{{a['sub']}}</a>
</span>
{% endfor %}
</div>
{% endif %}
<div class="d-flex justify-content-between align-items-center">
<div>
{% if v and v.id != u.id %}