FEATURE: per-topic unsubscribe option in emails#9
Open
akshayutture-augment wants to merge 1 commit into
Open
Conversation
Author
|
cursor review |
| tu.notification_level = TopicUser.notification_levels[:muted] | ||
| end | ||
|
|
||
| tu.save! |
There was a problem hiding this comment.
Bug: Unsubscribe fails for missing topic user.
The unsubscribe method calls TopicUser.find_by which returns nil when no TopicUser record exists for the user-topic combination. The code then attempts to access tu.notification_level and call tu.save! without checking if tu is nil, causing a NoMethodError when users who haven't interacted with the topic try to unsubscribe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test 2
Replicated from ai-code-review-evaluation/discourse-cursor#2
Note
Adds a per-topic unsubscribe endpoint and UI, updates email templates/links to point to it, and wires supporting routes, model helper, and tests.
unsubscribe_urland render%{unsubscribe_link}innotification.html.erband text bodies viaMessageBuilder.unsubscribe_urltopost.topic.unsubscribe_urlinUserNotifications#send_notification_email.List-Unsubscribeheader and keep respond instructions formatting.unsubscribe_urlhandling.TopicsController#unsubscribeaction to downgradeTopicUser.notification_level(toregularormuted) and render topic view; allow non-XHR.GET /t/:slug/:topic_id/unsubscribeand fallbackGET /t/:topic_id/unsubscribe.Topic#unsubscribe_urlhelper.topicUnsubscribe, controllertopic-unsubscribe.js.es6, view, and templatetemplates/topic/unsubscribe.hbswithtopic-notifications-button.PostStream.loadTopicView, hidenotificationReasonText, and show footer..topic-unsubscribe .notification-optionsdropdown.dropdown-buttononly renders title<h4>whentitleis present; other minor ES6/const cleanups.topic.unsubscribe.*and serverunsubscribe_linktext including per-topic link.Written by Cursor Bugbot for commit 6669a2d. Configure here.