diff options
author | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-01-18 08:17:48 +0100 |
---|---|---|
committer | Achilleas Pipinellis <axilleas@axilleas.me> | 2016-01-18 08:17:48 +0100 |
commit | 3ecb3024a40882896632ff78789713a4552a19ab (patch) | |
tree | e2a250e2434edde20f3e64431fc39d77a4d45977 /app/controllers/sent_notifications_controller.rb | |
parent | 07f5a6f107529a932ca7d657a8473cba1afcba05 (diff) | |
parent | 835f1961e65fe9b4f943b17747b1518c555e8bfd (diff) | |
download | gitlab-ce-docs_refactor.tar.gz |
Merge branch 'master' into docs_refactordocs_refactor
Diffstat (limited to 'app/controllers/sent_notifications_controller.rb')
-rw-r--r-- | app/controllers/sent_notifications_controller.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/controllers/sent_notifications_controller.rb b/app/controllers/sent_notifications_controller.rb new file mode 100644 index 00000000000..7271c933b9b --- /dev/null +++ b/app/controllers/sent_notifications_controller.rb @@ -0,0 +1,25 @@ +class SentNotificationsController < ApplicationController + skip_before_action :authenticate_user! + + def unsubscribe + @sent_notification = SentNotification.for(params[:id]) + return render_404 unless @sent_notification && @sent_notification.unsubscribable? + + noteable = @sent_notification.noteable + noteable.unsubscribe(@sent_notification.recipient) + + flash[:notice] = "You have been unsubscribed from this thread." + if current_user + case noteable + when Issue + redirect_to issue_path(noteable) + when MergeRequest + redirect_to merge_request_path(noteable) + else + redirect_to root_path + end + else + redirect_to new_user_session_path + end + end +end |