mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
community - show stats in side pane
This commit is contained in:
parent
5187149be4
commit
8e093a2c0c
3 changed files with 8 additions and 2 deletions
|
@ -439,6 +439,7 @@ def do_subscribe(actor, user_id, admin_preload=False):
|
||||||
# for local communities, joining is instant
|
# for local communities, joining is instant
|
||||||
member = CommunityMember(user_id=user.id, community_id=community.id)
|
member = CommunityMember(user_id=user.id, community_id=community.id)
|
||||||
db.session.add(member)
|
db.session.add(member)
|
||||||
|
community.subscriptions_count += 1
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
if remote:
|
if remote:
|
||||||
# send ActivityPub message to remote community, asking to follow. Accept message will be sent to our shared inbox
|
# send ActivityPub message to remote community, asking to follow. Accept message will be sent to our shared inbox
|
||||||
|
@ -533,6 +534,7 @@ def unsubscribe(actor):
|
||||||
if proceed:
|
if proceed:
|
||||||
db.session.query(CommunityMember).filter_by(user_id=current_user.id, community_id=community.id).delete()
|
db.session.query(CommunityMember).filter_by(user_id=current_user.id, community_id=community.id).delete()
|
||||||
db.session.query(CommunityJoinRequest).filter_by(user_id=current_user.id, community_id=community.id).delete()
|
db.session.query(CommunityJoinRequest).filter_by(user_id=current_user.id, community_id=community.id).delete()
|
||||||
|
community.subscriptions_count -= 1
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
flash('You have left ' + community.title)
|
flash('You have left ' + community.title)
|
||||||
|
|
|
@ -34,6 +34,10 @@
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p>{{ community.description_html|community_links|safe if community.description_html else '' }}</p>
|
<p>{{ community.description_html|community_links|safe if community.description_html else '' }}</p>
|
||||||
<p>{{ community.rules_html|safe if community.rules_html else '' }}</p>
|
<p>{{ community.rules_html|safe if community.rules_html else '' }}</p>
|
||||||
|
<p>{{ _('Subscribers') }}: {{ community.subscriptions_count }}<br>
|
||||||
|
{{ _('Posts') }}: {{ community.post_count }}<br>
|
||||||
|
{{ _('Comments') }}: {{ community.post_reply_count }}
|
||||||
|
</p>
|
||||||
{% if len(mods) > 0 and not community.private_mods -%}
|
{% if len(mods) > 0 and not community.private_mods -%}
|
||||||
<h3>Moderators</h3>
|
<h3>Moderators</h3>
|
||||||
<ul class="moderator_list">
|
<ul class="moderator_list">
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
{% if community.nsfl -%}<span class="warning_badge nsfl" title="{{ _('Not safe for life') }}">nsfl</span>{% endif -%}
|
{% if community.nsfl -%}<span class="warning_badge nsfl" title="{{ _('Not safe for life') }}">nsfl</span>{% endif -%}
|
||||||
</h1>
|
</h1>
|
||||||
{% elif community.icon_id and not low_bandwidth -%}
|
{% elif community.icon_id and not low_bandwidth -%}
|
||||||
<div class="row">
|
<div class="row mb-3">
|
||||||
<nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
|
<nav class="mb-3" aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
{% for breadcrumb in breadcrumbs -%}
|
{% for breadcrumb in breadcrumbs -%}
|
||||||
<li class="breadcrumb-item">{% if breadcrumb.url -%}<a href="{{ breadcrumb.url }}">{% endif -%}{{ breadcrumb.text }}{% if breadcrumb.url -%}</a>{% endif -%}</li>
|
<li class="breadcrumb-item">{% if breadcrumb.url -%}<a href="{{ breadcrumb.url }}">{% endif -%}{{ breadcrumb.text }}{% if breadcrumb.url -%}</a>{% endif -%}</li>
|
||||||
|
|
Loading…
Add table
Reference in a new issue