you have to halt the plug pipeline explicitly

This commit is contained in:
byte[] 2020-05-04 03:18:36 -04:00
parent 6d673a4fed
commit 4b86e783ef
10 changed files with 10 additions and 1 deletions

View file

@ -23,6 +23,7 @@ defmodule PhilomenaWeb.Api.Json.Image.FeaturedController do
conn conn
|> put_status(:not_found) |> put_status(:not_found)
|> text("") |> text("")
|> halt()
_ -> _ ->
interactions = Interactions.user_interactions([featured_image], user) interactions = Interactions.user_interactions([featured_image], user)

View file

@ -47,6 +47,7 @@ defmodule PhilomenaWeb.Filter.HideController do
conn conn
|> put_status(:forbidden) |> put_status(:forbidden)
|> text("") |> text("")
|> halt()
end end
end end
end end

View file

@ -47,6 +47,7 @@ defmodule PhilomenaWeb.Filter.SpoilerController do
conn conn
|> put_status(:forbidden) |> put_status(:forbidden)
|> text("") |> text("")
|> halt()
end end
end end
end end

View file

@ -59,6 +59,7 @@ defmodule PhilomenaWeb.Image.DeleteController do
conn conn
|> put_flash(:error, "Cannot change hide reason on a non-hidden image!") |> put_flash(:error, "Cannot change hide reason on a non-hidden image!")
|> redirect(to: Routes.image_path(conn, :show, conn.assigns.image)) |> redirect(to: Routes.image_path(conn, :show, conn.assigns.image))
|> halt()
end end
end end

View file

@ -24,6 +24,7 @@ defmodule PhilomenaWeb.Image.FeatureController do
conn conn
|> put_flash(:error, "Cannot feature a hidden image.") |> put_flash(:error, "Cannot feature a hidden image.")
|> redirect(to: Routes.image_path(conn, :show, conn.assigns.image)) |> redirect(to: Routes.image_path(conn, :show, conn.assigns.image))
|> halt()
_false -> _false ->
conn conn

View file

@ -35,6 +35,7 @@ defmodule PhilomenaWeb.Image.FileController do
conn conn
|> put_flash(:error, "Cannot replace a hidden image.") |> put_flash(:error, "Cannot replace a hidden image.")
|> redirect(to: Routes.image_path(conn, :show, conn.assigns.image)) |> redirect(to: Routes.image_path(conn, :show, conn.assigns.image))
|> halt()
_false -> _false ->
conn conn

View file

@ -188,7 +188,7 @@ defmodule PhilomenaWeb.ImageController do
"The image you were looking for has been marked a duplicate of the image below" "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))
|> Plug.Conn.halt() |> halt()
true -> true ->
conn conn

View file

@ -149,6 +149,7 @@ defmodule PhilomenaWeb.Profile.CommissionController do
conn conn
|> put_flash(:error, "You must have a verified user link to create a commission listing.") |> put_flash(:error, "You must have a verified user link to create a commission listing.")
|> redirect(to: Routes.commission_path(conn, :index)) |> redirect(to: Routes.commission_path(conn, :index))
|> halt()
end end
end end
end end

View file

@ -153,6 +153,7 @@ defmodule PhilomenaWeb.TagController do
"This tag (\"#{conn.assigns.tag.name}\") has been aliased into the tag \"#{tag.name}\"." "This tag (\"#{conn.assigns.tag.name}\") has been aliased into the tag \"#{tag.name}\"."
) )
|> redirect(to: Routes.tag_path(conn, :show, tag)) |> redirect(to: Routes.tag_path(conn, :show, tag))
|> halt()
end end
end end
end end

View file

@ -31,6 +31,7 @@ defmodule PhilomenaWeb.EnsureUserEnabledPlug do
conn conn
|> Plug.delete() |> Plug.delete()
|> Controller.redirect(to: Routes.pow_session_path(conn, :new)) |> Controller.redirect(to: Routes.pow_session_path(conn, :new))
|> Conn.halt()
end end
defp maybe_halt(_any, conn), do: conn defp maybe_halt(_any, conn), do: conn