From 9ba670c864e2959e5c256f7dbe01fd3b14ff725f Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 28 Apr 2024 21:13:51 -0400 Subject: [PATCH] truncated_ip_link --- .../templates/admin/approval/_approvals.html.slime | 2 +- lib/philomena_web/templates/admin/report/_reports.html.slime | 2 +- lib/philomena_web/views/admin/approval_view.ex | 3 +-- lib/philomena_web/views/admin/report_view.ex | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/philomena_web/templates/admin/approval/_approvals.html.slime b/lib/philomena_web/templates/admin/approval/_approvals.html.slime index f0448000..d3d3f5fc 100644 --- a/lib/philomena_web/templates/admin/approval/_approvals.html.slime +++ b/lib/philomena_web/templates/admin/approval/_approvals.html.slime @@ -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 diff --git a/lib/philomena_web/templates/admin/report/_reports.html.slime b/lib/philomena_web/templates/admin/report/_reports.html.slime index a423d1e7..30b4ad36 100644 --- a/lib/philomena_web/templates/admin/report/_reports.html.slime +++ b/lib/philomena_web/templates/admin/report/_reports.html.slime @@ -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 diff --git a/lib/philomena_web/views/admin/approval_view.ex b/lib/philomena_web/views/admin/approval_view.ex index 03b0f3c2..12d6284b 100644 --- a/lib/philomena_web/views/admin/approval_view.ex +++ b/lib/philomena_web/views/admin/approval_view.ex @@ -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", diff --git a/lib/philomena_web/views/admin/report_view.ex b/lib/philomena_web/views/admin/report_view.ex index 7f81d93d..82de807d 100644 --- a/lib/philomena_web/views/admin/report_view.ex +++ b/lib/philomena_web/views/admin/report_view.ex @@ -25,7 +25,7 @@ defmodule PhilomenaWeb.Admin.ReportView do def truncate(<>), 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 <> = ip -> link(string <> "...", to: ~p"/ip_profiles/#{ip}")