mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
link_to_reported_thing, link_to_noted_thing
This commit is contained in:
parent
e69f1bf3fa
commit
c506ef884e
8 changed files with 20 additions and 20 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue