mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
fix can? usage
This commit is contained in:
parent
1203475869
commit
9a3ef4df30
2 changed files with 2 additions and 2 deletions
|
@ -149,7 +149,7 @@ defmodule PhilomenaWeb.ImageController do
|
||||||
is_nil(image) ->
|
is_nil(image) ->
|
||||||
PhilomenaWeb.NotFoundPlug.call(conn)
|
PhilomenaWeb.NotFoundPlug.call(conn)
|
||||||
|
|
||||||
not is_nil(image.duplicate_id) and not Canada.Can.can?(conn, :show, image) ->
|
not is_nil(image.duplicate_id) and not Canada.Can.can?(conn.assigns.current_user, :show, image) ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "The image you were looking for has been marked a duplicate of the image below")
|
|> put_flash(:info, "The image you were looking for has been marked a duplicate of the image below")
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image.duplicate_id))
|
|> redirect(to: Routes.image_path(conn, :show, image.duplicate_id))
|
||||||
|
|
|
@ -87,6 +87,6 @@ defmodule PhilomenaWeb.ReportController do
|
||||||
reports_open >= 5
|
reports_open >= 5
|
||||||
end
|
end
|
||||||
|
|
||||||
defp redirect_path(conn, nil), do: "/"
|
defp redirect_path(_conn, nil), do: "/"
|
||||||
defp redirect_path(conn, _user), do: Routes.report_path(conn, :index)
|
defp redirect_path(conn, _user), do: Routes.report_path(conn, :index)
|
||||||
end
|
end
|
Loading…
Reference in a new issue