mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 03:43:42 -08:00
Merge pull request 'fix staff on about page' (#226) from h3ndrik/pyfedi:user_role into main
Reviewed-on: https://codeberg.org/rimu/pyfedi/pulls/226
This commit is contained in:
commit
c04d9522cd
3 changed files with 8 additions and 4 deletions
|
@ -340,8 +340,8 @@ def about_page():
|
||||||
MAU = active_month()
|
MAU = active_month()
|
||||||
posts_amount = local_posts()
|
posts_amount = local_posts()
|
||||||
|
|
||||||
admins = db.session.execute(text('SELECT user_name, email FROM "user" WHERE "id" IN (SELECT "user_id" FROM "user_role" WHERE "role_id" = 4) ORDER BY id')).all()
|
admins = Site.admins()
|
||||||
staff = db.session.execute(text('SELECT user_name FROM "user" WHERE "id" IN (SELECT "user_id" FROM "user_role" WHERE "role_id" = 2) ORDER BY id')).all()
|
staff = Site.staff()
|
||||||
domains_amount = db.session.execute(text('SELECT COUNT(id) as c FROM "domain" WHERE "banned" IS false')).scalar()
|
domains_amount = db.session.execute(text('SELECT COUNT(id) as c FROM "domain" WHERE "banned" IS false')).scalar()
|
||||||
community_amount = local_communities()
|
community_amount = local_communities()
|
||||||
instance = Instance.query.filter_by(id=1).first()
|
instance = Instance.query.filter_by(id=1).first()
|
||||||
|
|
|
@ -1506,7 +1506,11 @@ class Site(db.Model):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def admins() -> List[User]:
|
def admins() -> List[User]:
|
||||||
return User.query.filter_by(deleted=False, banned=False).join(user_role).filter(user_role.c.role_id == 4).all()
|
return User.query.filter_by(deleted=False, banned=False).join(user_role).filter(user_role.c.role_id == 4).order_by(User.id).all()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def staff() -> List[User]:
|
||||||
|
return User.query.filter_by(deleted=False, banned=False).join(user_role).filter(user_role.c.role_id == 3).order_by(User.id).all()
|
||||||
|
|
||||||
|
|
||||||
#class IngressQueue(db.Model):
|
#class IngressQueue(db.Model):
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<h1>{{ _('About %(site_name)s', site_name=g.site.name) }}</h1>
|
<h1>{{ _('About %(site_name)s', site_name=g.site.name) }}</h1>
|
||||||
<p> {{g.site.name}} is a <a href="https://join.piefed.social/">pyfedi</a> instance created on {{instance.created_at.strftime('%d-%m-%Y')}}. It is home to <a href="/people">{{user_amount}} users</a> (of which {{mau}} active in the last month). In the <a href="/communities/local"> {{community_amount}} communities</a> we discussed <a href="/domains">{{domains_amount}} domains</a> and made {{posts_amount}} posts.</p>
|
<p> {{g.site.name}} is a <a href="https://join.piefed.social/">pyfedi</a> instance created on {{instance.created_at.strftime('%d-%m-%Y')}}. It is home to <a href="/people">{{user_amount}} users</a> (of which {{mau}} active in the last month). In the <a href="/communities/local"> {{community_amount}} communities</a> we discussed <a href="/domains">{{domains_amount}} domains</a> and made {{posts_amount}} posts.</p>
|
||||||
<h2> Team </h2>
|
<h2> Team </h2>
|
||||||
<p>This instance is administerred by {% for admin in admins %}<a href="/u/{{ admin.user_name }}">{{ admin.user_name }}</a>{{ ", " if not loop.last }}{% endfor %}.</p>
|
<p>This instance is administered by {% for admin in admins %}<a href="/u/{{ admin.user_name }}">{{ admin.user_name }}</a>{{ ", " if not loop.last }}{% endfor %}.</p>
|
||||||
{% if staff %}
|
{% if staff %}
|
||||||
<p>It is moderated by {% for s in staff %}<a href="/u/{{ s.user_name }}">{{ s.user_name }}</a>{{ ", " if not loop.last }}{% endfor %}.</p>
|
<p>It is moderated by {% for s in staff %}<a href="/u/{{ s.user_name }}">{{ s.user_name }}</a>{{ ", " if not loop.last }}{% endfor %}.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue