fix: forum email notification links now point to specific reply
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

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) <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-04-09 22:47:10 +02:00
parent 32336c2488
commit 593da4aebb
2 changed files with 4 additions and 3 deletions

View File

@ -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}")

View File

@ -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()