diff options
author | Alexandru Croitor <acroitor@gitlab.com> | 2019-09-10 15:30:07 +0300 |
---|---|---|
committer | Alexandru Croitor <acroitor@gitlab.com> | 2019-09-23 11:58:12 +0300 |
commit | a4e04c4c64dd6523643197eb50eb3e8c9d2cbf42 (patch) | |
tree | 4bb6fa9f896d443e7585f960b555861a351b686d /app | |
parent | 7099ecf77cb45c7b456a47f24064657ca59549b7 (diff) | |
download | gitlab-ce-a4e04c4c64dd6523643197eb50eb3e8c9d2cbf42.tar.gz |
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.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/sent_notifications_controller.rb b/app/controllers/sent_notifications_controller.rb index 51a67cd2e3b..893f5145e99 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 |