Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlexandru Croitor <acroitor@gitlab.com>2019-09-10 15:30:07 +0300
committerAlexandru Croitor <acroitor@gitlab.com>2019-09-20 10:29:43 +0300
commitfcc8136a9e94615130c62a3c64485aa895673d54 (patch)
treeb267ac28c290057b2a24a73d4bd8f4f9b08f0f87 /app
parent39381519f294742e4083dfd6a50c0c8ceddecd5d (diff)
Redirect user to root path after unsubscribing from private resource
If user unsubsrcribes from a resource that they no longer have access to they should not be revealed the resource path, but be redirected to app root instead. https://gitlab.com/gitlab-org/gitlab-ce/issues/64938
Diffstat (limited to 'app')
-rw-r--r--app/controllers/sent_notifications_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/sent_notifications_controller.rb b/app/controllers/sent_notifications_controller.rb
index 77757c4a3ef..267f8caab77 100644
--- a/app/controllers/sent_notifications_controller.rb
+++ b/app/controllers/sent_notifications_controller.rb
@@ -19,7 +19,11 @@ class SentNotificationsController < ApplicationController
flash[:notice] = _("You have been unsubscribed from this thread.")
if current_user
- redirect_to noteable_path(noteable)
+ if current_user.can?(:"read_#{noteable.class.to_ability_name}", noteable)
+ redirect_to noteable_path(noteable)
+ else
+ redirect_to root_path
+ end
else
redirect_to new_user_session_path
end