fix: Only link to user if the account still exists
This commit is contained in:
parent
f23b6904c9
commit
953f2c3950
5 changed files with 7 additions and 4 deletions
|
@ -17,6 +17,9 @@ defmodule BdfrBrowser.RenderUtils do
|
|||
|> Earmark.as_html!()
|
||||
end
|
||||
|
||||
def link_to_user(name) when name in ~w([deleted] DELETED), do: name
|
||||
def link_to_user(name), do: "<a href=\"/user/#{name}\">#{name}</a>"
|
||||
|
||||
# Helper
|
||||
|
||||
defp maybe_insert_image(<<"mxc://reddit.com/", filename::binary>> = msg, replacement) do
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<% end %>
|
||||
|
||||
<footer class="blockquote-footer">
|
||||
<a href="/user/<%= comment.author %>"><%= comment.author %></a>,
|
||||
<%= BdfrBrowser.RenderUtils.link_to_user(comment.author) %>,
|
||||
<small><%= DateTime.to_iso8601(comment.posted_at) %></small>
|
||||
</footer>
|
||||
</blockquote>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<%= BdfrBrowser.RenderUtils.message(message.message) %>
|
||||
|
||||
<footer class="blockquote-footer">
|
||||
<a href="/user/<%= message.author %>"><%= message.author %></a>,
|
||||
<%= BdfrBrowser.RenderUtils.link_to_user(message.author) %>,
|
||||
<small><%= DateTime.to_iso8601(message.posted_at) %></small>
|
||||
|
||||
<%= unless is_nil(message.bookmark) do %>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<h2><%= post.title %></h2>
|
||||
|
||||
<p>
|
||||
<small><a href="/user/<%= post.author %>"><%= post.author %></a></small>
|
||||
<small><%= BdfrBrowser.RenderUtils.link_to_user(post.author) %></small>
|
||||
-
|
||||
<small><%= DateTime.to_iso8601(post.posted_at) %></small>
|
||||
-
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<%= BdfrBrowser.RenderUtils.comment(comment.body) %>
|
||||
|
||||
<footer class="blockquote-footer">
|
||||
<a href="/user/<%= comment.author %>"><%= comment.author %></a>,
|
||||
<%= BdfrBrowser.RenderUtils.link_to_user(comment.author) %>,
|
||||
<a href="/r/<%= comment.subreddit %>/<%= comment.post_date %>/<%= comment.post_id %>"><%= comment.post_title %></a>,
|
||||
<a href="/r/<%= comment.subreddit %>/<%= comment.post_date %>/"><%= comment.subreddit %></a>,
|
||||
<small><%= DateTime.to_iso8601(comment.posted_at) %></small>
|
||||
|
|
Reference in a new issue