Aevann 2023-06-24 20:16:24 +03:00
parent 1a2d51c34c
commit 7cac2c19a1
2 changed files with 32 additions and 4 deletions

View File

@ -13,6 +13,7 @@ from flask import g, session, request
from files.classes import Base
from files.classes.casino_game import CasinoGame
from files.classes.group import GroupMembership
from files.classes.sub import Sub
from files.helpers.config.const import *
from files.helpers.config.modaction_types import *
@ -812,6 +813,11 @@ class User(Base):
def moderated_subs(self):
return [x[0] for x in g.db.query(Mod.sub).filter_by(user_id=self.id).all()]
@property
@lazy
def ping_groups(self):
return [x[0] for x in g.db.query(GroupMembership.group_name).filter_by(user_id=self.id).all()]
@lazy
def has_follower(self, user):
if not user or self.id == user.id: return False # users can't follow themselves

View File

@ -131,9 +131,20 @@
{% if u.moderated_subs %}
<div class="text-white rounded p-2 mb-3" id="profile--holes" style="background-color: rgba(50, 50, 50, 0.6); width: 30%;">
<p class="text-uppercase my-0 pb-1" style="font-weight: bold; font-size: 12px;">Moderator of</p>
{% for a in u.moderated_subs %}
{% for i in u.moderated_subs %}
<span class="d-inline-block mx-1">
<a href="/h/{{a}}">/h/{{a}}</a>
<a href="/h/{{i}}">/h/{{i}}</a>
</span>
{% endfor %}
</div>
{% endif %}
{% if u.ping_groups %}
<div class="text-white rounded p-2 mb-3" id="profile--groups" style="background-color: rgba(50, 50, 50, 0.6); width: 30%;">
<p class="text-uppercase my-0 pb-1" style="font-weight: bold; font-size: 12px;">Member of</p>
{% for i in u.ping_groups %}
<span class="d-inline-block mx-1">
<a href="/!{{i}}">!{{i}}</a>
</span>
{% endfor %}
</div>
@ -400,9 +411,20 @@
{% if u.moderated_subs %}
<div class="text-white rounded p-2 mb-3" id="profile-mobile--holes" style="background-color: rgba(50, 50, 50, 0.6);">
<p class="text-uppercase my-0 pb-1" style="font-weight: bold; font-size: 12px;">Moderator of</p>
{% for a in u.moderated_subs %}
{% for i in u.moderated_subs %}
<span class="d-inline-block mx-1">
<a href="/h/{{a}}">/h/{{a}}</a>
<a href="/h/{{i}}">/h/{{i}}</a>
</span>
{% endfor %}
</div>
{% endif %}
{% if u.ping_groups %}
<div class="text-white rounded p-2 mb-3" id="profile-mobile--groups" style="background-color: rgba(50, 50, 50, 0.6);">
<p class="text-uppercase my-0 pb-1" style="font-weight: bold; font-size: 12px;">Member of</p>
{% for i in u.ping_groups %}
<span class="d-inline-block mx-1">
<a href="/!{{i}}">!{{i}}</a>
</span>
{% endfor %}
</div>