fix can? usage

This commit is contained in:
byte[] 2019-12-07 11:52:27 -05:00
parent 1203475869
commit 9a3ef4df30
2 changed files with 2 additions and 2 deletions

View file

@ -149,7 +149,7 @@ defmodule PhilomenaWeb.ImageController do
is_nil(image) ->
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
|> 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))

View file

@ -87,6 +87,6 @@ defmodule PhilomenaWeb.ReportController do
reports_open >= 5
end
defp redirect_path(conn, nil), do: "/"
defp redirect_path(_conn, nil), do: "/"
defp redirect_path(conn, _user), do: Routes.report_path(conn, :index)
end