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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
93096247
Commit
93096247
authored
Jan 04, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't notify users twice if they are both project watchers and subscribers
Closes #4708
parent
6f4ea679
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
CHANGELOG
CHANGELOG
+1
-0
app/services/notification_service.rb
app/services/notification_service.rb
+1
-0
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+12
-0
No files found.
CHANGELOG
View file @
93096247
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.4.0 (unreleased)
v 8.4.0 (unreleased)
- Expire view caches when application settings change (e.g. Gravatar disabled) (Stan Hu)
- Expire view caches when application settings change (e.g. Gravatar disabled) (Stan Hu)
- Don't notify users twice if they are both project watchers and subscribers (Stan Hu)
- Implement new UI for group page
- Implement new UI for group page
- Implement search inside emoji picker
- Implement search inside emoji picker
- Add API support for looking up a user by username (Stan Hu)
- Add API support for looking up a user by username (Stan Hu)
...
...
app/services/notification_service.rb
View file @
93096247
...
@@ -413,6 +413,7 @@ class NotificationService
...
@@ -413,6 +413,7 @@ class NotificationService
recipients
=
reject_unsubscribed_users
(
recipients
,
target
)
recipients
=
reject_unsubscribed_users
(
recipients
,
target
)
recipients
.
delete
(
current_user
)
recipients
.
delete
(
current_user
)
recipients
=
recipients
.
uniq
recipients
recipients
end
end
...
...
spec/services/notification_service_spec.rb
View file @
93096247
...
@@ -61,6 +61,7 @@ describe NotificationService, services: true do
...
@@ -61,6 +61,7 @@ describe NotificationService, services: true do
should_email
(
note
.
noteable
.
assignee
)
should_email
(
note
.
noteable
.
assignee
)
should_email
(
@u_mentioned
)
should_email
(
@u_mentioned
)
should_email
(
@subscriber
)
should_email
(
@subscriber
)
should_email
(
@watcher_and_subscriber
)
should_email
(
@subscribed_participant
)
should_email
(
@subscribed_participant
)
should_not_email
(
note
.
author
)
should_not_email
(
note
.
author
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_participating
)
...
@@ -245,6 +246,7 @@ describe NotificationService, services: true do
...
@@ -245,6 +246,7 @@ describe NotificationService, services: true do
should_email
(
@u_watcher
)
should_email
(
@u_watcher
)
should_email
(
@u_participant_mentioned
)
should_email
(
@u_participant_mentioned
)
should_email
(
@subscriber
)
should_email
(
@subscriber
)
should_email
(
@watcher_and_subscriber
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_disabled
)
should_not_email
(
@u_disabled
)
...
@@ -260,6 +262,7 @@ describe NotificationService, services: true do
...
@@ -260,6 +262,7 @@ describe NotificationService, services: true do
should_email
(
@u_watcher
)
should_email
(
@u_watcher
)
should_email
(
@u_participant_mentioned
)
should_email
(
@u_participant_mentioned
)
should_email
(
@subscriber
)
should_email
(
@subscriber
)
should_email
(
@watcher_and_subscriber
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_participating
)
end
end
...
@@ -282,6 +285,7 @@ describe NotificationService, services: true do
...
@@ -282,6 +285,7 @@ describe NotificationService, services: true do
should_email
(
merge_request
.
assignee
)
should_email
(
merge_request
.
assignee
)
should_email
(
@u_watcher
)
should_email
(
@u_watcher
)
should_email
(
@watcher_and_subscriber
)
should_email
(
@u_participant_mentioned
)
should_email
(
@u_participant_mentioned
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_disabled
)
should_not_email
(
@u_disabled
)
...
@@ -296,6 +300,7 @@ describe NotificationService, services: true do
...
@@ -296,6 +300,7 @@ describe NotificationService, services: true do
should_email
(
@u_watcher
)
should_email
(
@u_watcher
)
should_email
(
@u_participant_mentioned
)
should_email
(
@u_participant_mentioned
)
should_email
(
@subscriber
)
should_email
(
@subscriber
)
should_email
(
@watcher_and_subscriber
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_disabled
)
should_not_email
(
@u_disabled
)
...
@@ -310,6 +315,7 @@ describe NotificationService, services: true do
...
@@ -310,6 +315,7 @@ describe NotificationService, services: true do
should_email
(
@u_watcher
)
should_email
(
@u_watcher
)
should_email
(
@u_participant_mentioned
)
should_email
(
@u_participant_mentioned
)
should_email
(
@subscriber
)
should_email
(
@subscriber
)
should_email
(
@watcher_and_subscriber
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_disabled
)
should_not_email
(
@u_disabled
)
...
@@ -324,6 +330,7 @@ describe NotificationService, services: true do
...
@@ -324,6 +330,7 @@ describe NotificationService, services: true do
should_email
(
@u_watcher
)
should_email
(
@u_watcher
)
should_email
(
@u_participant_mentioned
)
should_email
(
@u_participant_mentioned
)
should_email
(
@subscriber
)
should_email
(
@subscriber
)
should_email
(
@watcher_and_subscriber
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_disabled
)
should_not_email
(
@u_disabled
)
...
@@ -338,6 +345,7 @@ describe NotificationService, services: true do
...
@@ -338,6 +345,7 @@ describe NotificationService, services: true do
should_email
(
@u_watcher
)
should_email
(
@u_watcher
)
should_email
(
@u_participant_mentioned
)
should_email
(
@u_participant_mentioned
)
should_email
(
@subscriber
)
should_email
(
@subscriber
)
should_email
(
@watcher_and_subscriber
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_disabled
)
should_not_email
(
@u_disabled
)
...
@@ -387,14 +395,18 @@ describe NotificationService, services: true do
...
@@ -387,14 +395,18 @@ describe NotificationService, services: true do
@subscriber
=
create
:user
@subscriber
=
create
:user
@unsubscriber
=
create
:user
@unsubscriber
=
create
:user
@subscribed_participant
=
create
(
:user
,
username:
'subscribed_participant'
,
notification_level:
Notification
::
N_PARTICIPATING
)
@subscribed_participant
=
create
(
:user
,
username:
'subscribed_participant'
,
notification_level:
Notification
::
N_PARTICIPATING
)
@watcher_and_subscriber
=
create
(
:user
,
notification_level:
Notification
::
N_WATCH
)
project
.
team
<<
[
@subscribed_participant
,
:master
]
project
.
team
<<
[
@subscribed_participant
,
:master
]
project
.
team
<<
[
@subscriber
,
:master
]
project
.
team
<<
[
@subscriber
,
:master
]
project
.
team
<<
[
@unsubscriber
,
:master
]
project
.
team
<<
[
@unsubscriber
,
:master
]
project
.
team
<<
[
@watcher_and_subscriber
,
:master
]
issuable
.
subscriptions
.
create
(
user:
@subscriber
,
subscribed:
true
)
issuable
.
subscriptions
.
create
(
user:
@subscriber
,
subscribed:
true
)
issuable
.
subscriptions
.
create
(
user:
@subscribed_participant
,
subscribed:
true
)
issuable
.
subscriptions
.
create
(
user:
@subscribed_participant
,
subscribed:
true
)
issuable
.
subscriptions
.
create
(
user:
@unsubscriber
,
subscribed:
false
)
issuable
.
subscriptions
.
create
(
user:
@unsubscriber
,
subscribed:
false
)
# Make the watcher a subscriber to detect dupes
issuable
.
subscriptions
.
create
(
user:
@watcher_and_subscriber
,
subscribed:
true
)
end
end
def
sent_to_user?
(
user
)
def
sent_to_user?
(
user
)
...
...
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