mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 03:43:42 -08:00
improve about page
This commit is contained in:
parent
6485f201d3
commit
49a3c587f9
2 changed files with 15 additions and 16 deletions
|
@ -10,7 +10,7 @@ from sqlalchemy.sql.operators import or_, and_
|
|||
|
||||
from app import db, cache
|
||||
from app.activitypub.util import default_context, make_image_sizes_async, refresh_user_profile, find_actor_or_create, \
|
||||
refresh_community_profile_task
|
||||
refresh_community_profile_task, users_total, active_month, local_posts, local_communities, local_comments
|
||||
from app.constants import SUBSCRIPTION_PENDING, SUBSCRIPTION_MEMBER, POST_TYPE_IMAGE, POST_TYPE_LINK, \
|
||||
SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR
|
||||
from app.email import send_email, send_welcome_email
|
||||
|
@ -48,7 +48,6 @@ def index(sort=None):
|
|||
def popular(sort=None):
|
||||
return home_page('popular', sort)
|
||||
|
||||
|
||||
@bp.route('/all', methods=['GET'])
|
||||
@bp.route('/all/<sort>', methods=['GET'])
|
||||
def all_posts(sort=None):
|
||||
|
@ -232,19 +231,17 @@ def donate():
|
|||
@bp.route('/about')
|
||||
def about_page():
|
||||
|
||||
users = User.query.filter_by(ap_id=None, deleted=False, banned=False).all()
|
||||
user_amount = len(users)
|
||||
# Todo, figure out how to filter the user list with the list of user_role user_id == 4
|
||||
#admins = users.filter()
|
||||
# Todo, figure out how to filter the user list with the list of user_role user_id == 4
|
||||
#staff = users.filter()
|
||||
|
||||
domains_amount = len(Domain.query.filter_by(banned=False).all())
|
||||
community_amount = len(Community.query.all())
|
||||
user_amount = users_total()
|
||||
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()
|
||||
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()
|
||||
|
||||
|
||||
return render_template('about.html', user_amount=user_amount, domains_amount=domains_amount, community_amount=community_amount, instance=instance)#, admins=admins)
|
||||
return render_template('about.html', user_amount=user_amount, mau=MAU, posts_amount=posts_amount, domains_amount=domains_amount, community_amount=community_amount, instance=instance, admins=admins, staff=staff)
|
||||
|
||||
|
||||
@bp.route('/privacy')
|
||||
|
|
|
@ -8,10 +8,12 @@
|
|||
<div class="row">
|
||||
<div class="col-12 col-md-8 position-relative main_pane">
|
||||
<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}}. It is home to <a href="/people">{{user_amount}} users</a>, <a href="/communities/local"> {{community_amount}} communities</a> who discussed <a href="/domains">{{domains_amount}} domains</a>. This instance is administerred and staffed by $PLACEHOLDER_ADMINS and $PLACEHOLDER_STAFF.</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>
|
||||
<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>It is moderated by {% for s in staff %}<a href="/u/{{ s.user_name }}">{{ s.user_name }}</a>{{ ", " if not loop.last }}{% endfor %}.</p>
|
||||
<h2>Contact</h2>
|
||||
<p>Placeholder Admin email</p>
|
||||
<p>$PLACEHOLDER_EMAIL</p>
|
||||
<h2> About Us </h2>
|
||||
<p> {{g.site.description | safe}} </p>
|
||||
<p> {{g.site.sidebar}} </p>
|
||||
|
|
Loading…
Add table
Reference in a new issue