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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
6df16564
Commit
6df16564
authored
Sep 14, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5076 from jzi/notify_commit_author
Re-enable notifying commit authors of new commit notes
parents
6113d806
49f609a9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
18 deletions
+19
-18
app/services/notification_service.rb
app/services/notification_service.rb
+7
-6
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+12
-12
No files found.
app/services/notification_service.rb
View file @
6df16564
...
@@ -107,12 +107,6 @@ class NotificationService
...
@@ -107,12 +107,6 @@ class NotificationService
opts
=
{
noteable_type:
note
.
noteable_type
,
project_id:
note
.
project_id
}
opts
=
{
noteable_type:
note
.
noteable_type
,
project_id:
note
.
project_id
}
if
note
.
commit_id
.
present?
opts
.
merge!
(
commit_id:
note
.
commit_id
)
else
opts
.
merge!
(
noteable_id:
note
.
noteable_id
)
end
target
=
note
.
noteable
target
=
note
.
noteable
if
target
.
respond_to?
(
:participants
)
if
target
.
respond_to?
(
:participants
)
recipients
=
target
.
participants
recipients
=
target
.
participants
...
@@ -120,6 +114,13 @@ class NotificationService
...
@@ -120,6 +114,13 @@ class NotificationService
recipients
=
note
.
mentioned_users
recipients
=
note
.
mentioned_users
end
end
if
note
.
commit_id
.
present?
opts
.
merge!
(
commit_id:
note
.
commit_id
)
recipients
<<
note
.
commit_author
else
opts
.
merge!
(
noteable_id:
note
.
noteable_id
)
end
# Get users who left comment in thread
# Get users who left comment in thread
recipients
=
recipients
.
concat
(
User
.
where
(
id:
Note
.
where
(
opts
).
pluck
(
:author_id
)))
recipients
=
recipients
.
concat
(
User
.
where
(
id:
Note
.
where
(
opts
).
pluck
(
:author_id
)))
...
...
spec/services/notification_service_spec.rb
View file @
6df16564
...
@@ -52,10 +52,12 @@ describe NotificationService do
...
@@ -52,10 +52,12 @@ describe NotificationService do
before
do
before
do
build_team
(
note
.
project
)
build_team
(
note
.
project
)
note
.
stub
(
:commit_author
=>
@u_committer
)
end
end
describe
:new_note
do
describe
:new_note
do
it
do
it
do
should_email
(
@u_committer
.
id
,
note
)
should_email
(
@u_watcher
.
id
,
note
)
should_email
(
@u_watcher
.
id
,
note
)
should_not_email
(
@u_mentioned
.
id
,
note
)
should_not_email
(
@u_mentioned
.
id
,
note
)
should_not_email
(
note
.
author_id
,
note
)
should_not_email
(
note
.
author_id
,
note
)
...
@@ -65,18 +67,14 @@ describe NotificationService do
...
@@ -65,18 +67,14 @@ describe NotificationService do
end
end
it
do
it
do
new_note
=
create
(
:note_on_commit
,
note
.
update_attribute
(
:note
,
'@mention referenced'
)
author:
@u_participating
,
should_email
(
@u_committer
.
id
,
note
)
project_id:
note
.
project_id
,
should_email
(
@u_watcher
.
id
,
note
)
commit_id:
note
.
commit_id
,
should_email
(
@u_mentioned
.
id
,
note
)
note:
'@mention referenced'
)
should_not_email
(
note
.
author_id
,
note
)
should_not_email
(
@u_participating
.
id
,
note
)
should_email
(
@u_watcher
.
id
,
new_note
)
should_not_email
(
@u_disabled
.
id
,
note
)
should_email
(
@u_mentioned
.
id
,
new_note
)
notification
.
new_note
(
note
)
should_not_email
(
new_note
.
author_id
,
new_note
)
should_not_email
(
@u_participating
.
id
,
new_note
)
should_not_email
(
@u_disabled
.
id
,
new_note
)
notification
.
new_note
(
new_note
)
end
end
def
should_email
(
user_id
,
n
)
def
should_email
(
user_id
,
n
)
...
@@ -240,10 +238,12 @@ describe NotificationService do
...
@@ -240,10 +238,12 @@ describe NotificationService do
@u_participating
=
create
(
:user
,
notification_level:
Notification
::
N_PARTICIPATING
)
@u_participating
=
create
(
:user
,
notification_level:
Notification
::
N_PARTICIPATING
)
@u_disabled
=
create
(
:user
,
notification_level:
Notification
::
N_DISABLED
)
@u_disabled
=
create
(
:user
,
notification_level:
Notification
::
N_DISABLED
)
@u_mentioned
=
create
(
:user
,
username:
'mention'
,
notification_level:
Notification
::
N_PARTICIPATING
)
@u_mentioned
=
create
(
:user
,
username:
'mention'
,
notification_level:
Notification
::
N_PARTICIPATING
)
@u_committer
=
create
(
:user
,
username:
'committer'
)
project
.
team
<<
[
@u_watcher
,
:master
]
project
.
team
<<
[
@u_watcher
,
:master
]
project
.
team
<<
[
@u_participating
,
:master
]
project
.
team
<<
[
@u_participating
,
:master
]
project
.
team
<<
[
@u_disabled
,
:master
]
project
.
team
<<
[
@u_disabled
,
:master
]
project
.
team
<<
[
@u_mentioned
,
:master
]
project
.
team
<<
[
@u_mentioned
,
:master
]
project
.
team
<<
[
@u_committer
,
:master
]
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