truncated_ip_link

This commit is contained in:
Liam 2024-04-28 21:13:51 -04:00
parent 2184d17086
commit bb9469e279
4 changed files with 4 additions and 5 deletions

View file

@ -21,7 +21,7 @@
= link image.user.name, to: ~p"/profiles/#{image.user}"
- else
em>
= truncated_ip_link(@conn, image.ip)
= truncated_ip_link(image.ip)
= link_to_fingerprint(@conn, image.fingerprint)
span = pretty_time(image.created_at)
.approval-items--footer

View file

@ -21,7 +21,7 @@ table.table
= link report.user.name, to: ~p"/profiles/#{report.user}"
- else
em>
= truncated_ip_link(@conn, report.ip)
= truncated_ip_link(report.ip)
= link_to_fingerprint(@conn, report.fingerprint)
= if not is_nil(report.user) and Enum.any?(report.user.linked_tags) do

View file

@ -3,8 +3,7 @@ defmodule PhilomenaWeb.Admin.ApprovalView do
alias PhilomenaWeb.Admin.ReportView
# Shamelessly copied from ReportView
def truncated_ip_link(conn, ip), do: ReportView.truncated_ip_link(conn, ip)
def truncated_ip_link(ip), do: ReportView.truncated_ip_link(ip)
def image_thumb(conn, image) do
render(PhilomenaWeb.ImageView, "_image_container.html",

View file

@ -25,7 +25,7 @@ defmodule PhilomenaWeb.Admin.ReportView do
def truncate(<<string::binary-size(50), _rest::binary>>), do: string <> "..."
def truncate(string), do: string
def truncated_ip_link(conn, ip) do
def truncated_ip_link(ip) do
case to_string(ip) do
<<string::binary-size(25), _rest::binary>> = ip ->
link(string <> "...", to: ~p"/ip_profiles/#{ip}")