images in report queue

This commit is contained in:
byte[] 2019-12-08 13:22:38 -05:00
parent ddc3ee61a1
commit 179d8a27d9
3 changed files with 13 additions and 1 deletions

View file

@ -18,7 +18,7 @@ defmodule Philomena.Polymorphic do
} }
@preloads %{ @preloads %{
"Comment" => [:user, :image], "Comment" => [:user, image: :tags],
"Commission" => [:user], "Commission" => [:user],
"Conversation" => [:from, :to], "Conversation" => [:from, :to],
"Gallery" => [:creator], "Gallery" => [:creator],

View file

@ -11,6 +11,7 @@ table.table
= for report <- @reports do = for report <- @reports do
tr tr
td td
=> reported_image @conn, report.reportable
= link_to_reported_thing @conn, report.reportable = link_to_reported_thing @conn, report.reportable
td td
span title=report.reason span title=report.reason

View file

@ -1,6 +1,9 @@
defmodule PhilomenaWeb.Admin.ReportView do defmodule PhilomenaWeb.Admin.ReportView do
use PhilomenaWeb, :view use PhilomenaWeb, :view
alias Philomena.Images.Image
alias Philomena.Comments.Comment
import PhilomenaWeb.ReportView, only: [link_to_reported_thing: 2, report_row_class: 1, pretty_state: 1] import PhilomenaWeb.ReportView, only: [link_to_reported_thing: 2, report_row_class: 1, pretty_state: 1]
import PhilomenaWeb.ProfileView, only: [user_abbrv: 2, current?: 2] import PhilomenaWeb.ProfileView, only: [user_abbrv: 2, current?: 2]
@ -20,4 +23,12 @@ defmodule PhilomenaWeb.Admin.ReportView do
def ordered_tags(tags) do def ordered_tags(tags) do
Enum.sort_by(tags, & &1.name) Enum.sort_by(tags, & &1.name)
end end
def reported_image(conn, %Image{} = image) do
render PhilomenaWeb.ImageView, "_image_container.html", image: image, size: :thumb_tiny, conn: conn
end
def reported_image(conn, %Comment{image: image}) do
render PhilomenaWeb.ImageView, "_image_container.html", image: image, size: :thumb_tiny, conn: conn
end
def reported_image(_conn, _reportable), do: nil
end end