mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 21:47:59 +01:00
fixes #80: broken presence check on tag_id param
This commit is contained in:
parent
d2c9975870
commit
44b004f9ec
1 changed files with 5 additions and 1 deletions
|
@ -131,7 +131,7 @@ defmodule PhilomenaWeb.DnpEntryController do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp selectable_tags(conn) do
|
defp selectable_tags(conn) do
|
||||||
case not is_nil(conn.params["tag_id"]) and
|
case present?(conn.params["tag_id"]) and
|
||||||
Canada.Can.can?(conn.assigns.current_user, :index, DnpEntry) do
|
Canada.Can.can?(conn.assigns.current_user, :index, DnpEntry) do
|
||||||
true -> [Repo.get!(Tag, conn.params["tag_id"])]
|
true -> [Repo.get!(Tag, conn.params["tag_id"])]
|
||||||
false -> linked_tags(conn)
|
false -> linked_tags(conn)
|
||||||
|
@ -146,6 +146,10 @@ defmodule PhilomenaWeb.DnpEntryController do
|
||||||
|
|
||||||
defp linked_tags(_), do: []
|
defp linked_tags(_), do: []
|
||||||
|
|
||||||
|
defp present?(nil), do: false
|
||||||
|
defp present?(""), do: false
|
||||||
|
defp present?(_), do: true
|
||||||
|
|
||||||
defp set_mod_notes(conn, _opts) do
|
defp set_mod_notes(conn, _opts) do
|
||||||
case Canada.Can.can?(conn.assigns.current_user, :index, ModNote) do
|
case Canada.Can.can?(conn.assigns.current_user, :index, ModNote) do
|
||||||
true ->
|
true ->
|
||||||
|
|
Loading…
Reference in a new issue