From 593da4aebbbbb5827aca44f93d882d1b116399da Mon Sep 17 00:00:00 2001 From: Maciej Pienczyn Date: Thu, 9 Apr 2026 22:47:10 +0200 Subject: [PATCH] fix: forum email notification links now point to specific reply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Email notifications for forum replies were linking to /forum/ID without the #reply-XX anchor. Now includes reply_id in the URL so the email "Zobacz odpowiedź" button scrolls directly to the new reply instead of the top of the topic. Co-Authored-By: Claude Opus 4.6 (1M context) --- blueprints/forum/routes.py | 3 ++- utils/notifications.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/blueprints/forum/routes.py b/blueprints/forum/routes.py index a4297e1..f03872d 100644 --- a/blueprints/forum/routes.py +++ b/blueprints/forum/routes.py @@ -443,7 +443,8 @@ def forum_reply(topic_id): topic_title=topic.title, replier_name=replier_name, reply_content=content, - subscriber_emails=subscriber_emails + subscriber_emails=subscriber_emails, + reply_id=reply.id ) except Exception as e: logger.warning(f"Failed to send email notifications: {e}") diff --git a/utils/notifications.py b/utils/notifications.py index 33beb0a..65833bb 100644 --- a/utils/notifications.py +++ b/utils/notifications.py @@ -257,7 +257,7 @@ def create_forum_reply_notification(topic_id, topic_title, replier_name, reply_i return count -def send_forum_reply_email(topic_id, topic_title, replier_name, reply_content, subscriber_emails): +def send_forum_reply_email(topic_id, topic_title, replier_name, reply_content, subscriber_emails, reply_id=None): """ Send email notifications to forum topic subscribers about a new reply. @@ -271,7 +271,7 @@ def send_forum_reply_email(topic_id, topic_title, replier_name, reply_content, s from email_service import send_email base_url = "https://nordabiznes.pl" - topic_url = f"{base_url}/forum/{topic_id}" + topic_url = f"{base_url}/forum/{topic_id}" + (f"#reply-{reply_id}" if reply_id else "") unsubscribe_url = f"{base_url}/forum/{topic_id}/unsubscribe" preview = reply_content[:200].strip()