diff --git a/app/community/routes.py b/app/community/routes.py index 6c32031b..648cb04c 100644 --- a/app/community/routes.py +++ b/app/community/routes.py @@ -911,7 +911,6 @@ def community_notification(community_id: int): return render_template('community/_notification_toggle.html', community=community) - @bp.route('//moderate', methods=['GET']) @login_required def community_moderate(actor): @@ -933,10 +932,13 @@ def community_moderate(actor): next_url = url_for('community.community_moderate', page=reports.next_num) if reports.has_next else None prev_url = url_for('community.community_moderate', page=reports.prev_num) if reports.has_prev and page != 1 else None + subscribers = community_subscribers(community.id) + subscriber_user_ids = [subscriber.user_id for subscriber in subscribers] + subscriber_list = User.query.filter(User.id.in_(subscriber_user_ids)).all() return render_template('community/community_moderate.html', title=_('Moderation of %(community)s', community=community.display_name()), community=community, reports=reports, current='reports', - next_url=next_url, prev_url=prev_url, + next_url=next_url, prev_url=prev_url, subscribers=subscriber_list, moderating_communities=moderating_communities(current_user.get_id()), joined_communities=joined_communities(current_user.get_id()), inoculation=inoculation[randint(0, len(inoculation) - 1)] @@ -946,18 +948,22 @@ def community_moderate(actor): else: abort(404) - -@bp.route('//moderate/banned', methods=['GET']) +@bp.route('//moderate/subscribers', methods=['GET']) @login_required -def community_moderate_banned(actor): +def community_moderate_subscribers(actor): community = actor_to_community(actor) if community is not None: if community.is_moderator() or current_user.is_admin(): + + subscribers = CommunityMember.query.filter(CommunityMember.community_id == community.id).all() + subscriber_user_ids = [subscriber.user_id for subscriber in subscribers] + subscriber_list = User.query.filter(User.id.in_(subscriber_user_ids)).all() + banned_people = User.query.join(CommunityBan, CommunityBan.user_id == User.id).filter(CommunityBan.community_id == community.id).all() - return render_template('community/community_moderate_banned.html', - title=_('People banned from of %(community)s', community=community.display_name()), - community=community, banned_people=banned_people, current='banned', + + return render_template('community/community_moderate_subscribers.html', title=_('Moderation of %(community)s', community=community.display_name()), + community=community, current='subscribers', subscribers=subscriber_list, banned_people=banned_people, moderating_communities=moderating_communities(current_user.get_id()), joined_communities=joined_communities(current_user.get_id()), inoculation=inoculation[randint(0, len(inoculation) - 1)] @@ -967,7 +973,6 @@ def community_moderate_banned(actor): else: abort(404) - @bp.route('/community//moderate_report//escalate', methods=['GET', 'POST']) @login_required def community_moderate_report_escalate(community_id, report_id): diff --git a/app/templates/community/_community_moderation_nav.html b/app/templates/community/_community_moderation_nav.html index 6dfd5de8..51825e1b 100644 --- a/app/templates/community/_community_moderation_nav.html +++ b/app/templates/community/_community_moderation_nav.html @@ -1,4 +1,4 @@ -
+
{% if community.is_owner() or current_user.is_admin() %} {{ _('Settings') }} @@ -10,8 +10,8 @@ {{ _('Reports') }} - - {{ _('Banned people') }} + + {{ _('Subscribers') }} {{ _('Appeals') }} diff --git a/app/templates/community/community_moderate_banned.html b/app/templates/community/community_moderate_banned.html deleted file mode 100644 index 74a5b200..00000000 --- a/app/templates/community/community_moderate_banned.html +++ /dev/null @@ -1,67 +0,0 @@ -{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %} - {% extends 'themes/' + theme() + '/base.html' %} -{% else %} - {% extends "base.html" %} -{% endif %} %} -{% from 'bootstrap/form.html' import render_field %} - -{% block app_content %} -
-
- - {% include "community/_community_moderation_nav.html" %} -
-
-

{{ _('Banned people') }}

-
-
- -
-
-

{{ _('See and manage who is banned from %(community)s', community=community.display_name()) }}

-

- {% if banned_people %} -
- - - - -
- - - - - - - - - {% for user in banned_people %} - - - - - - - - {% endfor %} -
NameLocal/RemoteReportsIPActions
- {{ user.display_name() }}{{ 'Local' if user.is_local() else 'Remote' }}{{ user.reports if user.reports > 0 }} {{ user.ip_address if user.ip_address }} {% if user.is_local() %} - View - {% else %} - View local | - View remote - {% endif %} - | {{ _('Un ban') }} -
- {% else %} -

{{ _('No banned people yet') }}

- {% endif %} -
-
-{% endblock %} \ No newline at end of file diff --git a/app/templates/community/community_moderate_subscribers.html b/app/templates/community/community_moderate_subscribers.html new file mode 100644 index 00000000..cb7de638 --- /dev/null +++ b/app/templates/community/community_moderate_subscribers.html @@ -0,0 +1,119 @@ +{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %} + {% extends 'themes/' + theme() + '/base.html' %} +{% else %} + {% extends "base.html" %} +{% endif %} %} +{% from 'bootstrap/form.html' import render_field %} + +{% block app_content %} +
+
+ + {% include "community/_community_moderation_nav.html" %} +
+
+

{{ _('Subscribers') }}

+
+
+ +
+
+

{{ _('See who is subscribed to %(community)s', community=community.display_name()) }}

+

+ {% if subscribers %} +
+ + + + + + + + + + {% for user in subscribers %} + + + + + + + + + {% endfor %} +
NameLocal/RemoteAboutLast SeenIPActions
+ {{ render_username(user) }} + {% if user.is_local() %} Local {% else %} {{ user.ap_domain }}{% endif %}{{ user.about_html | safe if user.about_html }} {{ moment(user.last_seen).fromNow() }} {{ user.ip_address if user.ip_address }} + +
+
+ {% else %} +

{{ _('This community has no subscribers') }}

+ {% endif %} +

{{ _('Banned People') }}

+

{{ _('See and manage who is banned from %(community)s', community=community.display_name()) }}

+ {% if banned_people %} +
+ + + + +
+
+ + + + + + + + + {% for user in banned_people %} + + + + + + + + {% endfor %} +
NameLocal/RemoteReportsIPActions
{{ render_username(user) }}{% if user.is_local() %} Local {% else %} {{ user.ap_domain }}{% endif %}{{ user.reports if user.reports > 0 }} {{ user.ip_address if user.ip_address }} + +
+
+ {% else %} +

{{ _('No banned people yet') }}

+ {% endif %} +
+
+{% endblock %} \ No newline at end of file