From 953f2c3950c2a9b08c88daa1be19c66bfb7f580c Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Tue, 29 Aug 2023 20:33:38 +0200 Subject: [PATCH] fix: Only link to user if the account still exists --- lib/bdfr_browser/render_utils.ex | 3 +++ priv/templates/http/_comment.eex | 2 +- priv/templates/http/chat.eex | 2 +- priv/templates/http/post.eex | 2 +- priv/templates/http/search.eex | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/bdfr_browser/render_utils.ex b/lib/bdfr_browser/render_utils.ex index 3b314c4..1530acd 100644 --- a/lib/bdfr_browser/render_utils.ex +++ b/lib/bdfr_browser/render_utils.ex @@ -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: "#{name}" + # Helper defp maybe_insert_image(<<"mxc://reddit.com/", filename::binary>> = msg, replacement) do diff --git a/priv/templates/http/_comment.eex b/priv/templates/http/_comment.eex index 6df9d92..57dff27 100644 --- a/priv/templates/http/_comment.eex +++ b/priv/templates/http/_comment.eex @@ -9,7 +9,7 @@ <% end %> diff --git a/priv/templates/http/chat.eex b/priv/templates/http/chat.eex index f5cc103..a5925f1 100644 --- a/priv/templates/http/chat.eex +++ b/priv/templates/http/chat.eex @@ -13,7 +13,7 @@ <%= BdfrBrowser.RenderUtils.message(message.message) %>