diff --git a/app/main/routes.py b/app/main/routes.py index e7374fbb..e53c6b69 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -340,8 +340,8 @@ def about_page(): MAU = active_month() 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() - 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() + admins = Site.admins() + staff = Site.staff() domains_amount = db.session.execute(text('SELECT COUNT(id) as c FROM "domain" WHERE "banned" IS false')).scalar() community_amount = local_communities() instance = Instance.query.filter_by(id=1).first() diff --git a/app/models.py b/app/models.py index 4ecf37cd..da2ebfe4 100644 --- a/app/models.py +++ b/app/models.py @@ -1506,7 +1506,11 @@ class Site(db.Model): @staticmethod 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): diff --git a/app/templates/about.html b/app/templates/about.html index a2acbdfb..90335ffb 100644 --- a/app/templates/about.html +++ b/app/templates/about.html @@ -10,7 +10,7 @@

{{ _('About %(site_name)s', site_name=g.site.name) }}

{{g.site.name}} is a pyfedi instance created on {{instance.created_at.strftime('%d-%m-%Y')}}. It is home to {{user_amount}} users (of which {{mau}} active in the last month). In the {{community_amount}} communities we discussed {{domains_amount}} domains and made {{posts_amount}} posts.

Team

-

This instance is administerred by {% for admin in admins %}{{ admin.user_name }}{{ ", " if not loop.last }}{% endfor %}.

+

This instance is administered by {% for admin in admins %}{{ admin.user_name }}{{ ", " if not loop.last }}{% endfor %}.

{% if staff %}

It is moderated by {% for s in staff %}{{ s.user_name }}{{ ", " if not loop.last }}{% endfor %}.

{% endif %}