chore: Adds multipart support on email rendering

This commit is contained in:
iamsivin
2025-04-29 14:35:03 +05:30
parent 9ab40adc24
commit 65b38bb4e4
2 changed files with 31 additions and 6 deletions
@@ -1,16 +1,23 @@
<% if @message.content_attributes&.dig('forwarded_message_id').present? %>
<% if @message.content_attributes&.dig('email').present? %>
<% if @message.content_attributes.dig('email', 'html_content', 'full').present? %>
<%= @message.content_attributes.dig('email', 'html_content', 'full').html_safe %>
<% elsif @message.content_attributes.dig('email', 'text_content', 'full').present? %>
<% if @message.content_attributes&.dig('email', 'html_content', 'full').present? %>
<%= @message.content_attributes.dig('email', 'html_content', 'full').html_safe %>
<% elsif @message.content_attributes&.dig('email', 'text_content', 'full').present? %>
<div>
<%= simple_format(@message.content_attributes.dig('email', 'text_content', 'full')) %>
<% end %>
</div>
<% elsif @message.content %>
<div>
<%= ChatwootMarkdownRenderer.new(@message.content).render_message.html_safe %>
</div>
<% end %>
<% else %>
<% if @message.content %>
<%= ChatwootMarkdownRenderer.new(@message.content).render_message %>
<div>
<%= ChatwootMarkdownRenderer.new(@message.content).render_message.html_safe %>
</div>
<% end %>
<% end %>
<% if @large_attachments.present? %>
<p>Attachments:</p>
<% @large_attachments.each do |attachment| %>
@@ -0,0 +1,18 @@
<% if @message.content_attributes&.dig('forwarded_message_id').present? %>
<% if @message.content_attributes&.dig('email', 'text_content', 'full').present? %>
<%= @message.content_attributes&.dig('email', 'text_content', 'full') %>
<% elsif @message.content %>
<%= @message.content %>
<% end %>
<% else %>
<% if @message.content %>
<%= @message.content %>
<% end %>
<% end %>
<% if @large_attachments.present? %>
Attachments:
<% @large_attachments.each do |attachment| %>
<%= attachment.file.filename.to_s %>: <%= attachment.file_url %>
<% end %>
<% end %>