Commit 09cffe96 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Merge branch 'fix-smtp-pool-errors' into 'master'

Fix delivery of service desk thank you email with SMTP pool

See merge request gitlab-org/gitlab!60843
parents 1738ef63 2a687a24
---
title: Fix SMTP errors when delivering service desk thank you emails with SMTP pool
enabled
merge_request: 60843
author:
type: fixed
......@@ -38,7 +38,7 @@ module Gitlab
if from_address
add_email_participant
send_thank_you_email!
send_thank_you_email
end
end
......@@ -92,8 +92,8 @@ module Gitlab
end
end
def send_thank_you_email!
Notify.service_desk_thank_you_email(@issue.id).deliver_later!
def send_thank_you_email
Notify.service_desk_thank_you_email(@issue.id).deliver_later
end
def message_including_template
......
......@@ -90,11 +90,6 @@ RSpec.describe Gitlab::Email::Handler::ServiceDeskHandler do
context 'when quick actions are present' do
let(:label) { create(:label, project: project, title: 'label1') }
let(:milestone) { create(:milestone, project: project) }
let!(:user) { create(:user, username: 'user1') }
before do
project.add_developer(user)
end
it 'applies quick action commands present on templates' do
file_content = %(Text from template \n/label ~#{label.title} \n/milestone %"#{milestone.name}"")
......
......@@ -30,5 +30,11 @@ module Mail
def deliver!(mail)
@pool.with { |conn| conn.deliver!(mail) }
end
# This makes it compatible with Mail's `#deliver!` method
# https://github.com/mikel/mail/blob/22a7afc23f253319965bf9228a0a430eec94e06d/lib/mail/message.rb#L271
def settings
{}
end
end
end
......@@ -64,5 +64,27 @@ describe Mail::SMTPPool do
expect(MockSMTP.deliveries.size).to eq(1)
end
context 'when called from Mail:Message' do
before do
mail.delivery_method(described_class, { pool: described_class.create_pool })
end
describe '#deliver' do
it 'delivers mail' do
mail.deliver
expect(MockSMTP.deliveries.size).to eq(1)
end
end
describe '#deliver!' do
it 'delivers mail' do
mail.deliver!
expect(MockSMTP.deliveries.size).to eq(1)
end
end
end
end
end
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