mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 03:43:42 -08:00
flag un-moderated communities
This commit is contained in:
parent
7458be190f
commit
9df02c649e
2 changed files with 14 additions and 2 deletions
|
@ -193,11 +193,20 @@ def show_community(community: Community):
|
||||||
is_owner = False
|
is_owner = False
|
||||||
is_admin = False
|
is_admin = False
|
||||||
|
|
||||||
|
# Build list of moderators and set un-moderated flag
|
||||||
|
mod_user_ids = [mod.user_id for mod in mods]
|
||||||
|
un_moderated = False
|
||||||
if community.private_mods:
|
if community.private_mods:
|
||||||
mod_list = []
|
mod_list = []
|
||||||
|
inactive_mods = User.query.filter(User.id.in_(mod_user_ids), User.last_seen < utcnow() - timedelta(days=60)).all()
|
||||||
else:
|
else:
|
||||||
mod_user_ids = [mod.user_id for mod in mods]
|
|
||||||
mod_list = User.query.filter(User.id.in_(mod_user_ids)).all()
|
mod_list = User.query.filter(User.id.in_(mod_user_ids)).all()
|
||||||
|
inactive_mods = []
|
||||||
|
for mod in mod_list:
|
||||||
|
if mod.last_seen < utcnow() - timedelta(days=60):
|
||||||
|
inactive_mods.append(mod)
|
||||||
|
if current_user.is_authenticated and (current_user.is_admin() or current_user.is_staff()):
|
||||||
|
un_moderated = len(mod_user_ids) == len(inactive_mods)
|
||||||
|
|
||||||
posts = community.posts
|
posts = community.posts
|
||||||
|
|
||||||
|
@ -305,7 +314,7 @@ def show_community(community: Community):
|
||||||
POST_TYPE_VIDEO=POST_TYPE_VIDEO, POST_TYPE_POLL=POST_TYPE_POLL, SUBSCRIPTION_PENDING=SUBSCRIPTION_PENDING,
|
POST_TYPE_VIDEO=POST_TYPE_VIDEO, POST_TYPE_POLL=POST_TYPE_POLL, SUBSCRIPTION_PENDING=SUBSCRIPTION_PENDING,
|
||||||
SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER, SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR,
|
SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER, SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR,
|
||||||
etag=f"{community.id}{sort}{post_layout}_{hash(community.last_active)}", related_communities=related_communities,
|
etag=f"{community.id}{sort}{post_layout}_{hash(community.last_active)}", related_communities=related_communities,
|
||||||
next_url=next_url, prev_url=prev_url, low_bandwidth=low_bandwidth,
|
next_url=next_url, prev_url=prev_url, low_bandwidth=low_bandwidth, un_moderated=un_moderated,
|
||||||
recently_upvoted=recently_upvoted, recently_downvoted=recently_downvoted,
|
recently_upvoted=recently_upvoted, recently_downvoted=recently_downvoted,
|
||||||
rss_feed=f"https://{current_app.config['SERVER_NAME']}/community/{community.link()}/feed", rss_feed_name=f"{community.title} on {g.site.name}",
|
rss_feed=f"https://{current_app.config['SERVER_NAME']}/community/{community.link()}/feed", rss_feed_name=f"{community.title} on {g.site.name}",
|
||||||
content_filters=content_filters, moderating_communities=moderating_communities(current_user.get_id()),
|
content_filters=content_filters, moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
|
|
|
@ -41,6 +41,9 @@
|
||||||
<li>{{ render_username(mod) }}</li>
|
<li>{{ render_username(mod) }}</li>
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
</ul>
|
</ul>
|
||||||
|
{% if un_moderated -%}
|
||||||
|
<p class="red small">{{ _('Moderators have not been active recently.') }}</p>
|
||||||
|
{% endif -%}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if not community.is_local() -%}
|
{% if not community.is_local() -%}
|
||||||
<ul>
|
<ul>
|
||||||
|
|
Loading…
Add table
Reference in a new issue