From 9a3ef4df302715975169f18d2ae2865738af7c37 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sat, 7 Dec 2019 11:52:27 -0500 Subject: [PATCH] fix can? usage --- lib/philomena_web/controllers/image_controller.ex | 2 +- lib/philomena_web/controllers/report_controller.ex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/philomena_web/controllers/image_controller.ex b/lib/philomena_web/controllers/image_controller.ex index 95f4ffae..6bd3d45c 100644 --- a/lib/philomena_web/controllers/image_controller.ex +++ b/lib/philomena_web/controllers/image_controller.ex @@ -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)) diff --git a/lib/philomena_web/controllers/report_controller.ex b/lib/philomena_web/controllers/report_controller.ex index 79962009..6c99f96d 100644 --- a/lib/philomena_web/controllers/report_controller.ex +++ b/lib/philomena_web/controllers/report_controller.ex @@ -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 \ No newline at end of file