fix(inboxes): stop disabled continuity mail sends

This commit is contained in:
Muhsin
2026-07-22 21:21:42 +04:00
parent 2437da5339
commit 949a728977
2 changed files with 9 additions and 0 deletions
+1
View File
@@ -4,6 +4,7 @@ class ConversationReplyEmailJob < ApplicationJob
def perform(conversation_id, last_queued_id)
conversation = Conversation.find(conversation_id)
return unless conversation.account.active?
return unless conversation.inbox.active?
if conversation.messages.incoming&.last&.content_type == 'incoming_email'
ConversationReplyMailer.with(account: conversation.account).reply_without_summary(conversation, last_queued_id).deliver_later
@@ -30,4 +30,12 @@ RSpec.describe ConversationReplyEmailJob, type: :job do
described_class.perform_now(conversation.id, 123)
expect(mailer).to have_received(:reply_without_summary)
end
it 'does not send an email when the inbox is disabled before the job runs' do
conversation.inbox.update!(active: false)
described_class.perform_now(conversation.id, 123)
expect(ConversationReplyMailer).not_to have_received(:with)
end
end