From 1fbe3bd555765a57bd9ba18363d0980537645870 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sat, 14 Dec 2019 22:25:11 -0500 Subject: [PATCH] ensure flash is fetched --- lib/philomena_web/plugs/not_authorized_plug.ex | 3 ++- lib/philomena_web/plugs/not_found_plug.ex | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/philomena_web/plugs/not_authorized_plug.ex b/lib/philomena_web/plugs/not_authorized_plug.ex index 42da7ca4..d0a99b4e 100644 --- a/lib/philomena_web/plugs/not_authorized_plug.ex +++ b/lib/philomena_web/plugs/not_authorized_plug.ex @@ -7,8 +7,9 @@ defmodule PhilomenaWeb.NotAuthorizedPlug do def call(conn), do: call(conn, nil) def call(conn, _opts) do conn + |> Controller.fetch_flash() |> Controller.put_flash(:error, "You can't access that page.") |> Controller.redirect(external: conn.assigns.referrer) |> Conn.halt() end -end \ No newline at end of file +end diff --git a/lib/philomena_web/plugs/not_found_plug.ex b/lib/philomena_web/plugs/not_found_plug.ex index 2f782b21..364dc627 100644 --- a/lib/philomena_web/plugs/not_found_plug.ex +++ b/lib/philomena_web/plugs/not_found_plug.ex @@ -7,8 +7,9 @@ defmodule PhilomenaWeb.NotFoundPlug do def call(conn), do: call(conn, nil) def call(conn, _opts) do conn + |> Controller.fetch_flash() |> Controller.put_flash(:error, "Couldn't find what you were looking for!") |> Controller.redirect(external: conn.assigns.referrer) |> Conn.halt() end -end \ No newline at end of file +end