mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Admins can see all of the modlog, everyone else can only see public entries #21
This commit is contained in:
parent
557e73d6a2
commit
bfdb8749e5
1 changed files with 8 additions and 1 deletions
|
@ -358,7 +358,14 @@ def modlog():
|
|||
page = request.args.get('page', 1, type=int)
|
||||
low_bandwidth = request.cookies.get('low_bandwidth', '0') == '1'
|
||||
|
||||
modlog_entries = ModLog.query.filter(ModLog.public == True).order_by(desc(ModLog.created_at))
|
||||
# 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))
|
||||
else:
|
||||
modlog_entries = ModLog.query.filter(ModLog.public == True).order_by(desc(ModLog.created_at))
|
||||
else:
|
||||
modlog_entries = ModLog.query.filter(ModLog.public == True).order_by(desc(ModLog.created_at))
|
||||
|
||||
# Pagination
|
||||
modlog_entries = modlog_entries.paginate(page=page, per_page=100 if not low_bandwidth else 50, error_out=False)
|
||||
|
|
Loading…
Add table
Reference in a new issue