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
def send_service_desk_notification(note)
return unless note.noteable_type == 'Issue'
return if note.confidential
issue = note.noteable
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
it_should_not_email!
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') }
before do
......@@ -422,6 +422,18 @@ RSpec.describe NotificationService, :mailer do
it_should_email!
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
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