2020-03-01 13:36:13 +00:00
|
|
|
class AgentNotifications::ConversationNotificationsMailer < ApplicationMailer
|
2020-05-01 09:23:43 +00:00
|
|
|
def conversation_creation(conversation, agent)
|
2020-03-01 13:36:13 +00:00
|
|
|
return unless smtp_config_set_or_development?
|
|
|
|
|
|
|
|
@agent = agent
|
|
|
|
@conversation = conversation
|
2020-08-01 13:00:47 +00:00
|
|
|
subject = "#{@agent.available_name}, A new conversation [ID - #{@conversation.display_id}] has been created in #{@conversation.inbox&.name}."
|
2020-08-06 09:51:06 +00:00
|
|
|
@action_url = app_account_conversation_url(account_id: @conversation.account_id, id: @conversation.display_id)
|
|
|
|
send_mail_with_liquid(to: @agent.email, subject: subject) and return
|
2020-03-01 13:36:13 +00:00
|
|
|
end
|
|
|
|
|
2020-05-01 09:23:43 +00:00
|
|
|
def conversation_assignment(conversation, agent)
|
2020-03-01 13:36:13 +00:00
|
|
|
return unless smtp_config_set_or_development?
|
|
|
|
|
|
|
|
@agent = agent
|
|
|
|
@conversation = conversation
|
2020-08-06 09:51:06 +00:00
|
|
|
subject = "#{@agent.available_name}, A new conversation [ID - #{@conversation.display_id}] has been assigned to you."
|
|
|
|
@action_url = app_account_conversation_url(account_id: @conversation.account_id, id: @conversation.display_id)
|
|
|
|
send_mail_with_liquid(to: @agent.email, subject: subject) and return
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def liquid_droppables
|
|
|
|
super.merge({
|
|
|
|
user: @agent,
|
|
|
|
conversation: @conversation,
|
|
|
|
inbox: @conversation.inbox
|
|
|
|
})
|
2020-03-01 13:36:13 +00:00
|
|
|
end
|
|
|
|
end
|