Skip to content

FEATURE: per-topic unsubscribe option in emails#9

Open
ShashankFC wants to merge 1 commit into
email-notifications-enhancementfrom
topic-email-management
Open

FEATURE: per-topic unsubscribe option in emails#9
ShashankFC wants to merge 1 commit into
email-notifications-enhancementfrom
topic-email-management

Conversation

@ShashankFC

@ShashankFC ShashankFC commented Jan 22, 2026

Copy link
Copy Markdown

Test 2

Summary by CodeRabbit

Release Notes

  • New Features
    • Users can now unsubscribe from topic notifications through a dedicated management page, allowing them to stop receiving notification alerts for specific topics.
    • Notification emails now include direct unsubscribe links, providing quick access to manage notification preferences.

✏️ Tip: You can customize this high-level summary in your review settings.


Replicated from ai-code-review-evaluation/discourse-coderabbit#2


Note

Medium Risk
Touches email template/translation interpolation and adds a new topic-level state toggle endpoint, so mistakes could affect unsubscribe links or notification levels for users.

Overview
Adds a per-topic unsubscribe flow: notification emails now include an unsubscribe_url, and the server unsubscribe_link copy is expanded to offer a per-topic “stop notifications” link alongside the existing global preferences link.

Implements new backend routes/controller action (TopicsController#unsubscribe) plus Topic#unsubscribe_url to toggle a user’s TopicUser.notification_level between regular and muted, and wires a new Ember route/template/controller/view for /t/:slug/:id/unsubscribe with minimal styling.

Includes small related cleanups/refactors (e.g., conditional dropdown title rendering, minor JS/Ruby formatting, and ensuring topic-from-params jumps to the resolved post).

Written by Cursor Bugbot for commit 6669a2d. Configure here.

@ShashankFC

Copy link
Copy Markdown
Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

tu.notification_level = TopicUser.notification_levels[:muted]
end

tu.save!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsubscribe crashes without topic-user row

Medium Severity

topics_controller.rb assumes TopicUser.find_by always returns a record. If a logged-in user can view a topic but has no topic_users row yet, tu.notification_level raises and the unsubscribe page fails with a server error instead of updating preferences.

Fix in Cursor Fix in Web

Comment thread config/routes.rb
get "t/:slug/:topic_id/moderator-liked" => "topics#moderator_liked", constraints: {topic_id: /\d+/}
get "t/:slug/:topic_id/summary" => "topics#show", defaults: {summary: true}, constraints: {topic_id: /\d+/}
get "t/:slug/:topic_id/unsubscribe" => "topics#unsubscribe", constraints: {topic_id: /\d+/}
get "t/:topic_id/unsubscribe" => "topics#unsubscribe", constraints: {topic_id: /\d+/}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

State-changing unsubscribe uses GET route

Medium Severity

The new GET unsubscribe endpoints mutate TopicUser.notification_level in topics#unsubscribe. Because this state change is performed via GET, third-party pages can trigger unsolicited preference changes for authenticated users through cross-site requests.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants