Fix to allow users to include deleted images again (#22)

This used to be allowed in the old searching with the `deleted` param for all users.

This should correctly add back the ability (using the new `del` param) to specify `del=1` for any user/API search, but correctly block them from doing the more specialized "staff only" searching.
This commit is contained in:
SomewhatDamaged 2020-01-14 22:54:15 +11:00 committed by liamwhite
parent 3315c60789
commit feefc2e5a7

View file

@ -67,13 +67,13 @@ defmodule PhilomenaWeb.ImageLoader do
end
# Allow moderators to index hidden images
defp maybe_show_deleted(filters, _show_hidden?, "1"),
do: filters
defp maybe_show_deleted(filters, false, _param),
do: [%{term: %{hidden_from_users: true}} | filters]
defp maybe_show_deleted(filters, true, "1"),
do: filters
defp maybe_show_deleted(filters, true, "only"),
do: [%{term: %{hidden_from_users: false}} | filters]