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