Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
74c7f240
Commit
74c7f240
authored
May 04, 2018
by
Mario de la Ossa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add notification unsubscribe redirect path for epics
parent
40c725b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
8 deletions
+60
-8
app/controllers/sent_notifications_controller.rb
app/controllers/sent_notifications_controller.rb
+14
-8
ee/app/controllers/ee/sent_notifications_controller.rb
ee/app/controllers/ee/sent_notifications_controller.rb
+14
-0
ee/spec/controllers/ee/sent_notifications_controller_spec.rb
ee/spec/controllers/ee/sent_notifications_controller_spec.rb
+32
-0
No files found.
app/controllers/sent_notifications_controller.rb
View file @
74c7f240
class
SentNotificationsController
<
ApplicationController
class
SentNotificationsController
<
ApplicationController
prepend
EE
::
SentNotificationsController
skip_before_action
:authenticate_user!
skip_before_action
:authenticate_user!
def
unsubscribe
def
unsubscribe
...
@@ -17,16 +19,20 @@ class SentNotificationsController < ApplicationController
...
@@ -17,16 +19,20 @@ class SentNotificationsController < ApplicationController
flash
[
:notice
]
=
"You have been unsubscribed from this thread."
flash
[
:notice
]
=
"You have been unsubscribed from this thread."
if
current_user
if
current_user
case
noteable
redirect_to
noteable_path
(
noteable
)
when
Issue
redirect_to
issue_path
(
noteable
)
when
MergeRequest
redirect_to
merge_request_path
(
noteable
)
else
redirect_to
root_path
end
else
else
redirect_to
new_user_session_path
redirect_to
new_user_session_path
end
end
end
end
def
noteable_path
(
noteable
)
case
noteable
when
Issue
issue_path
(
noteable
)
when
MergeRequest
merge_request_path
(
noteable
)
else
root_path
end
end
end
end
ee/app/controllers/ee/sent_notifications_controller.rb
0 → 100644
View file @
74c7f240
module
EE
module
SentNotificationsController
extend
::
Gitlab
::
Utils
::
Override
private
override
:noteable_path
def
noteable_path
(
noteable
)
return
epic_path
(
noteable
)
if
noteable
.
is_a?
(
Epic
)
super
end
end
end
ee/spec/controllers/ee/sent_notifications_controller_spec.rb
0 → 100644
View file @
74c7f240
require
'rails_helper'
describe
SentNotificationsController
do
let
(
:user
)
{
create
(
:user
)
}
context
'Unsubscribing from an epic'
do
let
(
:epic
)
do
create
(
:epic
,
author:
user
)
do
|
epic
|
epic
.
subscriptions
.
create
(
user:
user
,
project:
nil
,
subscribed:
true
)
end
end
let
(
:sent_notification
)
{
create
(
:sent_notification
,
project:
nil
,
noteable:
epic
,
recipient:
user
)
}
before
do
sign_in
(
user
)
get
(
:unsubscribe
,
id:
sent_notification
.
reply_key
)
end
it
'unsubscribes the user'
do
expect
(
epic
.
subscribed?
(
user
)).
to
be_falsey
end
it
'sets the flash message'
do
expect
(
controller
).
to
set_flash
[
:notice
].
to
(
/unsubscribed/
)
end
it
'redirects to the merge request page'
do
expect
(
response
)
.
to
redirect_to
(
group_epic_path
(
epic
.
group
,
epic
))
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment