diff --git a/lib/philomena_web/templates/comment/_comment.html.slime b/lib/philomena_web/templates/comment/_comment.html.slime index d2733757..ced8c1fb 100644 --- a/lib/philomena_web/templates/comment/_comment.html.slime +++ b/lib/philomena_web/templates/comment/_comment.html.slime @@ -27,7 +27,7 @@ article.block.communication id="comment_#{@comment.id}" .communication__info =<> @comment.ip .communication__info - =<> @comment.fingerprint + =<> link_to_fingerprint(@comment.fingerprint) /- if can?(:hide, Comment) / .js-staff-action / - if !comment.hidden_from_users && !comment.destroyed_content diff --git a/lib/philomena_web/views/comment_view.ex b/lib/philomena_web/views/comment_view.ex index fbe88c11..27b565cc 100644 --- a/lib/philomena_web/views/comment_view.ex +++ b/lib/philomena_web/views/comment_view.ex @@ -1,3 +1,19 @@ defmodule PhilomenaWeb.CommentView do use PhilomenaWeb, :view + + def link_to_ip(ip) do + if ip do + ip + else + "N/A" + end + end + + def link_to_fingerprint(fp) do + if fp do + fp |> String.slice(0..6) + else + "N/A" + end + end end