only show who did what moderation actions to admins and staff

This commit is contained in:
rimu 2024-08-14 07:47:41 +12:00
parent 91f61299d4
commit b640d6aaee
2 changed files with 5 additions and 3 deletions

View file

@ -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()),

View file

@ -14,7 +14,7 @@
<thead>
<tr>
<th>{{ _('When') }}</th>
<th>{{ _('Moderator') }}</th>
{% if can_see_names %}<th>{{ _('Moderator') }}</th>{% endif %}
<th>{{ _('Action') }}</th>
</tr>
</thead>
@ -22,7 +22,7 @@
{% for modlog_entry in modlog_entries.items %}
<tr>
<td>{{ moment(modlog_entry.created_at).fromNow() }}</td>
<td>{{ render_username(modlog_entry.author) }}</td>
{% if can_see_names %}<td>{{ render_username(modlog_entry.author) }}</td>{% endif %}
<td>{{ modlog_entry.action_to_str() }}
{% if modlog_entry.link and modlog_entry.link_text -%}
<a href="/{{ modlog_entry.link }}">{{ modlog_entry.link_text}}</a>