truncate FP and use helpers

This commit is contained in:
Luna D 2019-12-05 14:59:40 -05:00
parent 01de0bdca7
commit 2b0e65e85e
No known key found for this signature in database
GPG key ID: D0F46C94720BAA4B
2 changed files with 17 additions and 1 deletions

View file

@ -27,7 +27,7 @@ article.block.communication id="comment_#{@comment.id}"
.communication__info .communication__info
=<> @comment.ip =<> @comment.ip
.communication__info .communication__info
=<> @comment.fingerprint =<> link_to_fingerprint(@comment.fingerprint)
/- if can?(:hide, Comment) /- if can?(:hide, Comment)
/ .js-staff-action / .js-staff-action
/ - if !comment.hidden_from_users && !comment.destroyed_content / - if !comment.hidden_from_users && !comment.destroyed_content

View file

@ -1,3 +1,19 @@
defmodule PhilomenaWeb.CommentView do defmodule PhilomenaWeb.CommentView do
use PhilomenaWeb, :view 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 end