From b9abfcfde7429fc8eb58d34e87abcd3ffd7cd72f Mon Sep 17 00:00:00 2001 From: Lephe Date: Mon, 12 Jul 2021 22:33:17 +0200 Subject: [PATCH] forum: properly redirect topic after changing forum The URL changes so using the referrer is not much of an option. --- app/routes/posts/edit.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/routes/posts/edit.py b/app/routes/posts/edit.py index ca53afb..da4d703 100644 --- a/app/routes/posts/edit.py +++ b/app/routes/posts/edit.py @@ -79,7 +79,11 @@ def edit_post(postid): for a, file in attachments: a.set_file(file) - return redirect(referrer) + # Determine topic URL now, in case forum was changed + if isinstance(p, Topic): + return redirect(url_for('forum_topic', f=p.forum, page=(p,1))) + else: + return redirect(referrer) # Non-submitted form if isinstance(p, Comment):