link_to_reported_thing, link_to_noted_thing

This commit is contained in:
Liam 2024-04-28 21:08:00 -04:00
parent e69f1bf3fa
commit c506ef884e
8 changed files with 20 additions and 20 deletions

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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