Fix dynamic typing mistake

This commit is contained in:
Liam 2024-04-08 12:46:54 -04:00
parent cc32f5d3b9
commit 3ffebd1533
2 changed files with 7 additions and 1 deletions

View file

@ -1,5 +1,5 @@
= cond do = cond do
- Enum.any?(@images) or Enum.any?(@tags, &Enum.any?(elem(&1, 0).dnp_entries)) -> - Enum.any?(@images) or override_display(@tags) ->
= render PhilomenaWeb.ImageView, "index.html", conn: @conn, tags: @tags, images: @images, header: "Searching for #{@conn.params["q"]}", route: fn p -> Routes.search_path(@conn, :index, p) end, scope: scope(@conn) = render PhilomenaWeb.ImageView, "index.html", conn: @conn, tags: @tags, images: @images, header: "Searching for #{@conn.params["q"]}", route: fn p -> Routes.search_path(@conn, :index, p) end, scope: scope(@conn)
- assigns[:error] -> - assigns[:error] ->

View file

@ -3,4 +3,10 @@ defmodule PhilomenaWeb.SearchView do
def scope(conn), do: PhilomenaWeb.ImageScope.scope(conn) def scope(conn), do: PhilomenaWeb.ImageScope.scope(conn)
def hides_images?(conn), do: can?(conn, :hide, %Philomena.Images.Image{}) def hides_images?(conn), do: can?(conn, :hide, %Philomena.Images.Image{})
def override_display([{_tag, _description, dnp_entries}]) do
Enum.any?(dnp_entries)
end
def override_display(_), do: false
end end