Show modded subs on userpage (#205)
* show modded subs * remove print lol * added links
This commit is contained in:
parent
cffc44bc9f
commit
e1dc79858f
3 changed files with 19 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
SITE_FULL = ""
|
||||
|
||||
from sqlalchemy import *
|
||||
from files.__main__ import Base
|
||||
from files.helpers.lazy import lazy
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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 %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue