From 37f949a9c5bd1e61f91c4f5f4554ea3a1f6f482f Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 28 Apr 2024 21:08:00 -0400 Subject: [PATCH] link_to_reported_thing, link_to_noted_thing --- .../templates/admin/mod_note/_table.html.slime | 2 +- .../templates/admin/report/_reports.html.slime | 2 +- .../templates/admin/report/show.html.slime | 2 +- .../templates/report/index.html.slime | 2 +- .../templates/report/new.html.slime | 2 +- lib/philomena_web/views/admin/mod_note_view.ex | 10 +++++----- lib/philomena_web/views/admin/report_view.ex | 4 ++-- lib/philomena_web/views/report_view.ex | 16 ++++++++-------- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/philomena_web/templates/admin/mod_note/_table.html.slime b/lib/philomena_web/templates/admin/mod_note/_table.html.slime index 6c143079..45207800 100644 --- a/lib/philomena_web/templates/admin/mod_note/_table.html.slime +++ b/lib/philomena_web/templates/admin/mod_note/_table.html.slime @@ -10,7 +10,7 @@ table.table = for {body, note} <- @mod_notes do tr td - = link_to_noted_thing(@conn, note.notable) + = link_to_noted_thing(note.notable) td = body diff --git a/lib/philomena_web/templates/admin/report/_reports.html.slime b/lib/philomena_web/templates/admin/report/_reports.html.slime index 743f51cb..9ac6563e 100644 --- a/lib/philomena_web/templates/admin/report/_reports.html.slime +++ b/lib/philomena_web/templates/admin/report/_reports.html.slime @@ -12,7 +12,7 @@ table.table tr td => reported_image @conn, report.reportable - = link_to_reported_thing @conn, report.reportable + = link_to_reported_thing report.reportable td span title=report.reason = truncate(report.reason) diff --git a/lib/philomena_web/templates/admin/report/show.html.slime b/lib/philomena_web/templates/admin/report/show.html.slime index d0d183a8..20835cdd 100644 --- a/lib/philomena_web/templates/admin/report/show.html.slime +++ b/lib/philomena_web/templates/admin/report/show.html.slime @@ -1,6 +1,6 @@ h1 Showing Report p - = link_to_reported_thing @conn, @report.reportable + = link_to_reported_thing @report.reportable article.block.communication .block__content.flex.flex--no-wrap diff --git a/lib/philomena_web/templates/report/index.html.slime b/lib/philomena_web/templates/report/index.html.slime index a7e35224..2d7d6563 100644 --- a/lib/philomena_web/templates/report/index.html.slime +++ b/lib/philomena_web/templates/report/index.html.slime @@ -18,6 +18,6 @@ h1 Your Reports tr td class=report_row_class(r) = pretty_state(r) - td = link_to_reported_thing(@conn, r.reportable) + td = link_to_reported_thing(r.reportable) td = r.reason td = pretty_time(r.created_at) diff --git a/lib/philomena_web/templates/report/new.html.slime b/lib/philomena_web/templates/report/new.html.slime index 15f2a32a..f7839783 100644 --- a/lib/philomena_web/templates/report/new.html.slime +++ b/lib/philomena_web/templates/report/new.html.slime @@ -1,7 +1,7 @@ h2 Submit a report p strong - = link_to_reported_thing(@conn, @reportable) + = link_to_reported_thing(@reportable) .image-other .dnp-warning diff --git a/lib/philomena_web/views/admin/mod_note_view.ex b/lib/philomena_web/views/admin/mod_note_view.ex index 463de66b..021e4721 100644 --- a/lib/philomena_web/views/admin/mod_note_view.ex +++ b/lib/philomena_web/views/admin/mod_note_view.ex @@ -5,20 +5,20 @@ defmodule PhilomenaWeb.Admin.ModNoteView do alias Philomena.Reports.Report alias Philomena.DnpEntries.DnpEntry - def link_to_noted_thing(conn, %DnpEntry{tag: tag} = dnp_entry), + def link_to_noted_thing(%DnpEntry{tag: tag} = dnp_entry), do: link("DNP entry for #{tag.name}", to: ~p"/dnp/#{dnp_entry}") - def link_to_noted_thing(conn, %Report{user: nil} = report), + def link_to_noted_thing(%Report{user: nil} = report), do: link("Report #{report.id}", to: ~p"/admin/reports/#{report}") - def link_to_noted_thing(conn, %Report{user: user} = report), + def link_to_noted_thing(%Report{user: user} = report), do: link("Report #{report.id} by #{user.name}", to: ~p"/admin/reports/#{report}" ) - def link_to_noted_thing(conn, %User{} = user), + def link_to_noted_thing(%User{} = user), do: link("User #{user.name}", to: ~p"/profiles/#{user}") - def link_to_noted_thing(_conn, _notable), do: "Item permanently deleted" + def link_to_noted_thing(_notable), do: "Item permanently deleted" end diff --git a/lib/philomena_web/views/admin/report_view.ex b/lib/philomena_web/views/admin/report_view.ex index a192c4fd..56337cd2 100644 --- a/lib/philomena_web/views/admin/report_view.ex +++ b/lib/philomena_web/views/admin/report_view.ex @@ -7,8 +7,8 @@ defmodule PhilomenaWeb.Admin.ReportView do alias PhilomenaWeb.ReportView alias PhilomenaWeb.ProfileView - defp link_to_reported_thing(conn, reportable), - do: ReportView.link_to_reported_thing(conn, reportable) + defp link_to_reported_thing(reportable), + do: ReportView.link_to_reported_thing(reportable) defp report_row_class(report), do: ReportView.report_row_class(report) diff --git a/lib/philomena_web/views/report_view.ex b/lib/philomena_web/views/report_view.ex index e33493be..35693434 100644 --- a/lib/philomena_web/views/report_view.ex +++ b/lib/philomena_web/views/report_view.ex @@ -41,31 +41,31 @@ defmodule PhilomenaWeb.ReportView do def pretty_state(%{state: "claimed"}), do: "Claimed" def pretty_state(_report), do: "Open" - def link_to_reported_thing(conn, %Image{} = r), + def link_to_reported_thing(%Image{} = r), do: link("Image >>#{r.id}", to: ~p"/images/#{r}") - def link_to_reported_thing(conn, %Comment{} = r), + def link_to_reported_thing(%Comment{} = r), do: link("Comment on image >>#{r.image.id}", to: ~p"/images/#{r.image}" <> "#comment_#{r.id}" ) - def link_to_reported_thing(conn, %Conversation{} = r), + def link_to_reported_thing(%Conversation{} = r), do: link("Conversation between #{r.from.name} and #{r.to.name}", to: ~p"/conversations/#{r}" ) - def link_to_reported_thing(conn, %Commission{} = r), + def link_to_reported_thing(%Commission{} = r), do: link("#{r.user.name}'s commission page", to: ~p"/profiles/#{r.user}/commission" ) - def link_to_reported_thing(conn, %Gallery{} = r), + def link_to_reported_thing(%Gallery{} = r), do: link("Gallery '#{r.title}' by #{r.creator.name}", to: ~p"/galleries/#{r}") - def link_to_reported_thing(conn, %Post{} = r), + def link_to_reported_thing(%Post{} = r), do: link("Post in #{r.topic.title}", to: @@ -73,10 +73,10 @@ defmodule PhilomenaWeb.ReportView do "#post_#{r.id}" ) - def link_to_reported_thing(conn, %User{} = r), + def link_to_reported_thing(%User{} = r), do: link("User '#{r.name}'", to: ~p"/profiles/#{r}") - def link_to_reported_thing(_conn, _reportable) do + def link_to_reported_thing(_reportable) do "Reported item permanently destroyed." end end