feat: Display sent status of emails in email channel (#3125)

This commit is contained in:
Pranav Raj S
2021-10-14 12:55:46 +05:30
committed by GitHub
parent 5c30bc3e2b
commit 99abbb8158
18 changed files with 187 additions and 55 deletions

View File

@@ -3,14 +3,14 @@ class ConversationReplyEmailWorker
include Sidekiq::Worker
sidekiq_options queue: :mailers
def perform(conversation_id, queued_time)
def perform(conversation_id, last_queued_id)
@conversation = Conversation.find(conversation_id)
# send the email
if @conversation.messages.incoming&.last&.content_type == 'incoming_email' || email_inbox?
ConversationReplyMailer.with(account: @conversation.account).reply_without_summary(@conversation, queued_time).deliver_later
if @conversation.messages.incoming&.last&.content_type == 'incoming_email'
ConversationReplyMailer.with(account: @conversation.account).reply_without_summary(@conversation, last_queued_id).deliver_later
else
ConversationReplyMailer.with(account: @conversation.account).reply_with_summary(@conversation, queued_time).deliver_later
ConversationReplyMailer.with(account: @conversation.account).reply_with_summary(@conversation, last_queued_id).deliver_later
end
# delete the redis set from the first new message on the conversation

View File

@@ -0,0 +1,14 @@
class EmailReplyWorker
include Sidekiq::Worker
sidekiq_options queue: :mailers
def perform(message_id)
message = Message.find(message_id)
return unless message.outgoing? || message.input_csat?
return if message.private?
# send the email
ConversationReplyMailer.with(account: message.account).email_reply(message).deliver_later
end
end