mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-03 00:31:25 -08:00
only show who did what moderation actions to admins and staff
This commit is contained in:
parent
91f61299d4
commit
b640d6aaee
2 changed files with 5 additions and 3 deletions
|
@ -360,11 +360,13 @@ def list_subscribed_communities():
|
||||||
def modlog():
|
def modlog():
|
||||||
page = request.args.get('page', 1, type=int)
|
page = request.args.get('page', 1, type=int)
|
||||||
low_bandwidth = request.cookies.get('low_bandwidth', '0') == '1'
|
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
|
# Admins can see all of the modlog, everyone else can only see public entries
|
||||||
if current_user.is_authenticated:
|
if current_user.is_authenticated:
|
||||||
if current_user.is_admin() or current_user.is_staff():
|
if current_user.is_admin() or current_user.is_staff():
|
||||||
modlog_entries = ModLog.query.order_by(desc(ModLog.created_at))
|
modlog_entries = ModLog.query.order_by(desc(ModLog.created_at))
|
||||||
|
can_see_names = True
|
||||||
else:
|
else:
|
||||||
modlog_entries = ModLog.query.filter(ModLog.public == True).order_by(desc(ModLog.created_at))
|
modlog_entries = ModLog.query.filter(ModLog.public == True).order_by(desc(ModLog.created_at))
|
||||||
else:
|
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
|
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',
|
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,
|
next_url=next_url, prev_url=prev_url, low_bandwidth=low_bandwidth,
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ _('When') }}</th>
|
<th>{{ _('When') }}</th>
|
||||||
<th>{{ _('Moderator') }}</th>
|
{% if can_see_names %}<th>{{ _('Moderator') }}</th>{% endif %}
|
||||||
<th>{{ _('Action') }}</th>
|
<th>{{ _('Action') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
{% for modlog_entry in modlog_entries.items %}
|
{% for modlog_entry in modlog_entries.items %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ moment(modlog_entry.created_at).fromNow() }}</td>
|
<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() }}
|
<td>{{ modlog_entry.action_to_str() }}
|
||||||
{% if modlog_entry.link and modlog_entry.link_text -%}
|
{% if modlog_entry.link and modlog_entry.link_text -%}
|
||||||
<a href="/{{ modlog_entry.link }}">{{ modlog_entry.link_text}}</a>
|
<a href="/{{ modlog_entry.link }}">{{ modlog_entry.link_text}}</a>
|
||||||
|
|
Loading…
Add table
Reference in a new issue