diff --git a/app/blueprints/admin/audit.py b/app/blueprints/admin/audit.py index 5abc06f..7cb8ef5 100644 --- a/app/blueprints/admin/audit.py +++ b/app/blueprints/admin/audit.py @@ -14,8 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from flask import render_template, request -from app.models import db, AuditLogEntry, UserRank +from flask import render_template, request, abort +from app.models import db, AuditLogEntry, UserRank, User from app.utils import rank_required, get_int_or_abort from . import bp @@ -27,7 +27,15 @@ def audit(): page = get_int_or_abort(request.args.get("page"), 1) num = min(40, get_int_or_abort(request.args.get("n"), 100)) - pagination = AuditLogEntry.query.order_by(db.desc(AuditLogEntry.created_at)).paginate(page, num, True) + query = AuditLogEntry.query.order_by(db.desc(AuditLogEntry.created_at)) + + if "username" in request.args: + user = User.query.filter_by(username=request.args.get("username")).first() + if not user: + abort(404) + query = query.filter_by(causer=user) + + pagination = query.paginate(page, num, True) return render_template("admin/audit.html", log=pagination.items, pagination=pagination) diff --git a/app/templates/users/account.html b/app/templates/users/account.html index 550c41b..ddd9320 100644 --- a/app/templates/users/account.html +++ b/app/templates/users/account.html @@ -59,6 +59,10 @@ +{% if current_user.rank.atLeast(current_user.rank.MODERATOR) %} + View All +{% endif %} +

{{ _("Recent Account Actions") }}

{% from "macros/audit_log.html" import render_audit_log %}