hide merge buttons when either image is hidden

This commit is contained in:
byte[] 2020-09-06 14:24:32 -04:00
parent 0d359ee81e
commit aa8da0103f
2 changed files with 5 additions and 1 deletions

View file

@ -16,7 +16,7 @@
p
= render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @image, conn: @conn
= if can?(@conn, :edit, @report) and same_rating_tags?(@report) do
= if can?(@conn, :edit, @report) and mergeable?(@report) do
= if @source do
a href=Routes.duplicate_report_accept_reverse_path(@conn, :create, @report) data-method="post"
button.button

View file

@ -102,6 +102,10 @@ defmodule PhilomenaWeb.DuplicateReportView do
def both_are_alternate_versions?(%{image: image, duplicate_of_image: duplicate_of_image}),
do: alternate_version?(image) and alternate_version?(duplicate_of_image)
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
end
defp artist_tags(%{tags: tags}) do
tags
|> Enum.filter(&(&1.namespace == "artist"))