From 8930e4a6409554de98e979be618b3aa08ffe69cd Mon Sep 17 00:00:00 2001 From: Hendrik L Date: Mon, 13 Jan 2025 16:23:45 +0100 Subject: [PATCH] htmx user_preview: redirect back --- app/templates/base.html | 8 ++++++-- app/user/routes.py | 12 ++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/templates/base.html b/app/templates/base.html index fa066b25..87951b47 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -1,4 +1,4 @@ -{% macro render_username(user, add_domain=True) -%} +{% macro render_username(user, add_domain=True, htmx_redirect_back_to=None) -%} {% if user.deleted -%} {% if current_user.is_authenticated and current_user.is_admin() -%} @@ -34,7 +34,11 @@ {% endif -%} {% endif -%}
/preview') def user_preview(user_id): user = User.query.get_or_404(user_id) + return_to = request.args.get('return_to') if (user.deleted or user.banned) and current_user.is_anonymous: abort(404) - return render_template('user/user_preview.html', user=user) + return render_template('user/user_preview.html', user=user, return_to=return_to) @bp.route('/user/lookup//')