feat: Add message content to mention email template (#2838)
This commit is contained in:
12
app/drops/message_drop.rb
Normal file
12
app/drops/message_drop.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class MessageDrop < BaseDrop
|
||||
include MessageFormatHelper
|
||||
|
||||
def sender_display_name
|
||||
@obj.sender.try(:display_name)
|
||||
end
|
||||
|
||||
def text_content
|
||||
content = @obj.try(:content)
|
||||
transform_user_mention_content content
|
||||
end
|
||||
end
|
||||
@@ -24,6 +24,7 @@ class AgentNotifications::ConversationNotificationsMailer < ApplicationMailer
|
||||
|
||||
@agent = agent
|
||||
@conversation = message.conversation
|
||||
@message = message
|
||||
subject = "#{@agent.available_name}, You have been mentioned in conversation [ID - #{@conversation.display_id}]"
|
||||
@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
|
||||
@@ -47,7 +48,8 @@ class AgentNotifications::ConversationNotificationsMailer < ApplicationMailer
|
||||
super.merge({
|
||||
user: @agent,
|
||||
conversation: @conversation,
|
||||
inbox: @conversation.inbox
|
||||
inbox: @conversation.inbox,
|
||||
message: @message
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
|
||||
# the models that exposed in email templates through liquid
|
||||
DROPPABLES = %w[Account Channel Conversation Inbox User].freeze
|
||||
DROPPABLES = %w[Account Channel Conversation Inbox User Message].freeze
|
||||
|
||||
# ModelDrop class should exist in app/drops
|
||||
def to_drop
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
<p>Hi {{user.available_name}}</p>
|
||||
<style type="text/css">
|
||||
.quoted-text--content {
|
||||
box-sizing:border-box;
|
||||
padding:8px 16px;
|
||||
margin:0 0 20px;
|
||||
font-size:14px;
|
||||
border-left:5px solid #eeeeee
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>Hi {{user.available_name}}, </p>
|
||||
|
||||
<p>Time to save the world. You have been mentioned in a conversation</p>
|
||||
<p>You've been mentioned in a conversation. <b>{{message.sender_display_name}}</b> wrote:</p>
|
||||
<blockquote class='quoted-text--content'>
|
||||
{{message.text_content}}
|
||||
</blockquote>
|
||||
|
||||
<p>
|
||||
Click <a href="{{ action_url }}">here</a> to get cracking.
|
||||
</p>
|
||||
<p><a href="{{ action_url }}">View Message</a></p>
|
||||
|
||||
Reference in New Issue
Block a user