From b640d6aaeef316f22f83aba881daca1574b7f269 Mon Sep 17 00:00:00 2001
From: rimu <3310831+rimu@users.noreply.github.com>
Date: Wed, 14 Aug 2024 07:47:41 +1200
Subject: [PATCH] only show who did what moderation actions to admins and staff
---
app/main/routes.py | 4 +++-
app/templates/modlog.html | 4 ++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/app/main/routes.py b/app/main/routes.py
index 13a0a185..4927c1bc 100644
--- a/app/main/routes.py
+++ b/app/main/routes.py
@@ -360,11 +360,13 @@ def list_subscribed_communities():
def modlog():
page = request.args.get('page', 1, type=int)
low_bandwidth = request.cookies.get('low_bandwidth', '0') == '1'
+ can_see_names = False
# Admins can see all of the modlog, everyone else can only see public entries
if current_user.is_authenticated:
if current_user.is_admin() or current_user.is_staff():
modlog_entries = ModLog.query.order_by(desc(ModLog.created_at))
+ can_see_names = True
else:
modlog_entries = ModLog.query.filter(ModLog.public == True).order_by(desc(ModLog.created_at))
else:
@@ -376,7 +378,7 @@ def modlog():
prev_url = url_for('main.modlog', page=modlog_entries.prev_num) if modlog_entries.has_prev and page != 1 else None
return render_template('modlog.html',
- title=_('Moderation Log'), modlog_entries=modlog_entries,
+ title=_('Moderation Log'), modlog_entries=modlog_entries, can_see_names=can_see_names,
next_url=next_url, prev_url=prev_url, low_bandwidth=low_bandwidth,
moderating_communities=moderating_communities(current_user.get_id()),
joined_communities=joined_communities(current_user.get_id()),
diff --git a/app/templates/modlog.html b/app/templates/modlog.html
index 00fac039..71309434 100644
--- a/app/templates/modlog.html
+++ b/app/templates/modlog.html
@@ -14,7 +14,7 @@
@@ -22,7 +22,7 @@
{% for modlog_entry in modlog_entries.items %}
{{ _('When') }}
- {{ _('Moderator') }}
+ {% if can_see_names %}{{ _('Moderator') }} {% endif %}
{{ _('Action') }}