summaryrefslogtreecommitdiff
path: root/app/controllers/sent_notifications_controller.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-09-16 17:08:09 +0200
committerRémy Coutable <remy@rymai.me>2016-09-20 09:52:57 +0200
commitc61a54f7fe932b9b76ce930aaccb04f897c4093b (patch)
tree883db81143794881d08d8c376847afc708dc7e3f /app/controllers/sent_notifications_controller.rb
parentb335730817e096bb4c68e5e4a4a2a3ec29b25243 (diff)
downloadgitlab-ce-c61a54f7fe932b9b76ce930aaccb04f897c4093b.tar.gz
Fix initial implementation to actually render the unsubscribe page
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/controllers/sent_notifications_controller.rb')
-rw-r--r--app/controllers/sent_notifications_controller.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/sent_notifications_controller.rb b/app/controllers/sent_notifications_controller.rb
index c4abc597cf1..3085ff33aba 100644
--- a/app/controllers/sent_notifications_controller.rb
+++ b/app/controllers/sent_notifications_controller.rb
@@ -2,12 +2,15 @@ class SentNotificationsController < ApplicationController
skip_before_action :authenticate_user!
def unsubscribe
- return redirect_to new_user_session_path unless current_user || params[:force]
-
@sent_notification = SentNotification.for(params[:id])
return render_404 unless @sent_notification && @sent_notification.unsubscribable?
+ return unsubscribe_and_redirect if current_user || params[:force]
+ end
+
+ private
+ def unsubscribe_and_redirect
noteable = @sent_notification.noteable
noteable.unsubscribe(@sent_notification.recipient)