diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-08-27 03:23:22 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-08-27 03:23:22 +0300 |
commit | ea5da30326a0515f98d7276c9cff239232cafed4 (patch) | |
tree | ea57b7032b879ffa77b8befa862f97aa81040d53 /spec/services | |
parent | 5b93c5579fabec5d7bcaf77128608ff2b9deecc5 (diff) |
Don't notify users without access to the project when they are (accidentally) mentioned in a note.
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/notification_service_spec.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index 9da6c9dc949..8865335d0d1 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -31,13 +31,16 @@ describe NotificationService do describe 'Notes' do context 'issue note' do - let(:project) { create(:empty_project, :public) } + let(:project) { create(:empty_project, :private) } let(:issue) { create(:issue, project: project, assignee: create(:user)) } let(:mentioned_issue) { create(:issue, assignee: issue.assignee) } - let(:note) { create(:note_on_issue, noteable: issue, project_id: issue.project_id, note: '@mention referenced') } + let(:note) { create(:note_on_issue, noteable: issue, project_id: issue.project_id, note: '@mention referenced, @outsider also') } before do build_team(note.project) + project.team << [issue.author, :master] + project.team << [issue.assignee, :master] + project.team << [note.author, :master] end describe :new_note do @@ -53,6 +56,7 @@ describe NotificationService do should_not_email(@u_participating.id) should_not_email(@u_disabled.id) should_not_email(@unsubscriber.id) + should_not_email(@u_outsider_mentioned) notification.new_note(note) end @@ -444,12 +448,15 @@ describe NotificationService do @u_mentioned = create(:user, username: 'mention', notification_level: Notification::N_MENTION) @u_committer = create(:user, username: 'committer') @u_not_mentioned = create(:user, username: 'regular', notification_level: Notification::N_PARTICIPATING) + @u_outsider_mentioned = create(:user, username: 'outsider') project.team << [@u_watcher, :master] project.team << [@u_participating, :master] + project.team << [@u_participant_mentioned, :master] project.team << [@u_disabled, :master] project.team << [@u_mentioned, :master] project.team << [@u_committer, :master] + project.team << [@u_not_mentioned, :master] end def add_users_with_subscription(project, issuable) |