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
8208d9f8
Commit
8208d9f8
authored
Jul 31, 2018
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allows builder to include watchers for group level target
parent
914a3b24
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
7 deletions
+34
-7
app/services/notification_recipient_service.rb
app/services/notification_recipient_service.rb
+7
-1
ee/spec/workers/new_epic_worker_spec.rb
ee/spec/workers/new_epic_worker_spec.rb
+27
-6
No files found.
app/services/notification_recipient_service.rb
View file @
8208d9f8
...
@@ -240,7 +240,13 @@ module NotificationRecipientService
...
@@ -240,7 +240,13 @@ module NotificationRecipientService
def
build!
def
build!
add_participants
(
current_user
)
add_participants
(
current_user
)
add_project_watchers
if
project
add_project_watchers
else
# for group level targets
add_group_watchers
end
add_custom_notifications
add_custom_notifications
# Re-assign is considered as a mention of the new assignee
# Re-assign is considered as a mention of the new assignee
...
...
ee/spec/workers/new_epic_worker_spec.rb
View file @
8208d9f8
...
@@ -35,19 +35,40 @@ describe NewEpicWorker do
...
@@ -35,19 +35,40 @@ describe NewEpicWorker do
end
end
context
'when everything is ok'
do
context
'when everything is ok'
do
let
(
:mentioned
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:epic
)
{
create
(
:epic
,
description:
"epic for
#{
mentioned
.
to_reference
}
"
)
}
let
(
:epic
)
{
create
(
:epic
)
}
before
do
before
do
stub_licensed_features
(
epics:
true
)
stub_licensed_features
(
epics:
true
)
end
end
it
'creates a notification for the mentioned user'
do
context
'user watches group'
do
expect
(
Notify
).
to
receive
(
:new_epic_email
).
with
(
mentioned
.
id
,
epic
.
id
,
NotificationReason
::
MENTIONED
)
before
do
.
and_return
(
double
(
deliver_later:
true
))
create
(
:notification_setting
,
user:
user
,
source:
epic
.
group
,
level:
NotificationSetting
.
levels
[
:watch
]
)
end
worker
.
perform
(
epic
.
id
,
user
.
id
)
it
'creates a notification for watcher'
do
expect
(
Notify
).
to
receive
(
:new_epic_email
).
with
(
user
.
id
,
epic
.
id
,
nil
)
.
and_return
(
double
(
deliver_later:
true
))
worker
.
perform
(
epic
.
id
,
user
.
id
)
end
end
context
'mention'
do
let
(
:epic
)
{
create
(
:epic
,
description:
"epic for
#{
user
.
to_reference
}
"
)
}
it
'creates a notification for the mentioned user'
do
expect
(
Notify
).
to
receive
(
:new_epic_email
).
with
(
user
.
id
,
epic
.
id
,
NotificationReason
::
MENTIONED
)
.
and_return
(
double
(
deliver_later:
true
))
worker
.
perform
(
epic
.
id
,
user
.
id
)
end
end
end
end
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