Commit 78768f5b authored by Lee Tickett's avatar Lee Tickett

Don't email issue email participants confidential comments

Recently introduced ocnfidential comments are being emailed
to issue email participants (when they should not). This
adds a check of comment confidentiality before deciding whether
an email should be sent to the issue email partcipants.

Changelog: fixed
parent 5def4911
...@@ -384,6 +384,7 @@ class NotificationService ...@@ -384,6 +384,7 @@ class NotificationService
def send_service_desk_notification(note) def send_service_desk_notification(note)
return unless note.noteable_type == 'Issue' return unless note.noteable_type == 'Issue'
return if note.confidential
issue = note.noteable issue = note.noteable
recipients = issue.email_participants_emails recipients = issue.email_participants_emails
......
---
title: Don't email issue email participants confidential comments
merge_request: 60594
author: Lee Tickett @leetickett
type: fixed
...@@ -412,7 +412,7 @@ RSpec.describe NotificationService, :mailer do ...@@ -412,7 +412,7 @@ RSpec.describe NotificationService, :mailer do
it_should_not_email! it_should_not_email!
end end
context 'do exist' do context 'do exist and note not confidential' do
let!(:issue_email_participant) { issue.issue_email_participants.create!(email: 'service.desk@example.com') } let!(:issue_email_participant) { issue.issue_email_participants.create!(email: 'service.desk@example.com') }
before do before do
...@@ -422,6 +422,18 @@ RSpec.describe NotificationService, :mailer do ...@@ -422,6 +422,18 @@ RSpec.describe NotificationService, :mailer do
it_should_email! it_should_email!
end end
context 'do exist and note is confidential' do
let(:note) { create(:note, noteable: issue, project: project, confidential: true) }
let!(:issue_email_participant) { issue.issue_email_participants.create!(email: 'service.desk@example.com') }
before do
issue.update!(external_author: 'service.desk@example.com')
project.update!(service_desk_enabled: true)
end
it_should_not_email!
end
end end
describe '#new_note' do describe '#new_note' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment