From 962af4d29b8b8dbfbab1c0595fdd333c4565c97c Mon Sep 17 00:00:00 2001 From: Luna D Date: Thu, 24 Mar 2022 17:52:57 +0100 Subject: [PATCH] happy little changes --- .../controllers/admin/approval_controller.ex | 2 +- .../templates/duplicate_report/_list.html.slime | 13 +++++++++---- lib/philomena_web/views/duplicate_report_view.ex | 11 ++++++++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/philomena_web/controllers/admin/approval_controller.ex b/lib/philomena_web/controllers/admin/approval_controller.ex index f5f8f2e9..74141507 100644 --- a/lib/philomena_web/controllers/admin/approval_controller.ex +++ b/lib/philomena_web/controllers/admin/approval_controller.ex @@ -12,7 +12,7 @@ defmodule PhilomenaWeb.Admin.ApprovalController do Image |> where(hidden_from_users: false) |> where(approved: false) - |> order_by(desc: :id) + |> order_by(asc: :id) |> preload([:user, tags: [:aliases, :aliased_tag]]) |> Repo.paginate(conn.assigns.scrivener) diff --git a/lib/philomena_web/templates/duplicate_report/_list.html.slime b/lib/philomena_web/templates/duplicate_report/_list.html.slime index 263ec700..87de9fc0 100644 --- a/lib/philomena_web/templates/duplicate_report/_list.html.slime +++ b/lib/philomena_web/templates/duplicate_report/_list.html.slime @@ -118,10 +118,15 @@ td.danger Different rating tags tr - = if forward_merge?(report) do - td.warning Target newer - - else - td.success Target older + = cond do + - not source_approved?(report) -> + td.danger Source is not approved + - not target_approved?(report) -> + td.danger Target is not approved + - forward_merge?(report) -> + td.warning Target newer + - true -> + td.success Target older .flex.flex--column.grid--dupe-report-list__cell.border-vertical id="report_options_#{report.id}" .dr__status-options class=background_class diff --git a/lib/philomena_web/views/duplicate_report_view.ex b/lib/philomena_web/views/duplicate_report_view.ex index c3b22ccf..34192974 100644 --- a/lib/philomena_web/views/duplicate_report_view.ex +++ b/lib/philomena_web/views/duplicate_report_view.ex @@ -104,7 +104,16 @@ defmodule PhilomenaWeb.DuplicateReportView do def mergeable?(%{image: image, duplicate_of_image: duplicate_of_image} = report) do same_rating_tags?(report) and not image.hidden_from_users and - not duplicate_of_image.hidden_from_users + not duplicate_of_image.hidden_from_users and image.approved and + duplicate_of_image.approved + end + + def source_approved?(%{image: image}) do + image.approved + end + + def target_approved?(%{duplicate_of_image: image}) do + image.approved end defp artist_tags(%{tags: tags}) do