chore: Move comment rendering to helper

This commit is contained in:
Daniel Kempkens 2023-08-15 13:56:44 +02:00
parent aa761d4112
commit 5d97a4f1d3
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
2 changed files with 5 additions and 1 deletions

View file

@ -1,4 +1,8 @@
defmodule BdfrBrowser.RenderUtils do defmodule BdfrBrowser.RenderUtils do
def comment(cmt) do
Earmark.as_html!(cmt)
end
def message(msg) do def message(msg) do
img_replacement = "<img src=\"/chat_media/\\1\" style=\"max-width: 500px;\" alt=\"Image\" />" img_replacement = "<img src=\"/chat_media/\\1\" style=\"max-width: 500px;\" alt=\"Image\" />"

View file

@ -5,7 +5,7 @@
<%= if comment.author == "AutoModerator" do %> <%= if comment.author == "AutoModerator" do %>
<p><small>Hidden AutoModerator comment</small></p> <p><small>Hidden AutoModerator comment</small></p>
<% else %> <% else %>
<%= Earmark.as_html!(comment.body) %> <%= BdfrBrowser.RenderUtils.comment(comment.body) %>
<% end %> <% end %>
<footer class="blockquote-footer"> <footer class="blockquote-footer">