mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
remove unnecessary referrer redirects
This commit is contained in:
parent
04b893eaaf
commit
a2e524b535
10 changed files with 14 additions and 20 deletions
|
@ -21,7 +21,7 @@ defmodule PhilomenaWeb.Admin.DnpEntry.TransitionController do
|
|||
{:error, _changeset} ->
|
||||
conn
|
||||
|> put_flash(:error, "Failed to update DNP entry!")
|
||||
|> redirect(external: conn.assigns.referrer)
|
||||
|> redirect(to: Routes.dnp_entry_path(conn, :show, conn.assigns.dnp_entry))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ defmodule PhilomenaWeb.Conversation.MessageController do
|
|||
_error ->
|
||||
conn
|
||||
|> put_flash(:error, "There was an error posting your message")
|
||||
|> redirect(external: conn.assigns.referrer)
|
||||
|> redirect(to: Routes.conversation_path(conn, :show, conversation))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ defmodule PhilomenaWeb.DuplicateReport.ClaimController do
|
|||
|
||||
conn
|
||||
|> put_flash(:info, "Successfully claimed report.")
|
||||
|> redirect(external: conn.assigns.referrer)
|
||||
|> redirect(to: Routes.duplicate_report_path(conn, :index))
|
||||
end
|
||||
|
||||
def delete(conn, _params) do
|
||||
|
@ -28,6 +28,6 @@ defmodule PhilomenaWeb.DuplicateReport.ClaimController do
|
|||
|
||||
conn
|
||||
|> put_flash(:info, "Successfully released report.")
|
||||
|> redirect(external: conn.assigns.referrer)
|
||||
|> redirect(to: Routes.duplicate_report_path(conn, :index))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,6 +21,6 @@ defmodule PhilomenaWeb.DuplicateReport.RejectController do
|
|||
|
||||
conn
|
||||
|> put_flash(:info, "Successfully rejected report.")
|
||||
|> redirect(external: conn.assigns.referrer)
|
||||
|> redirect(to: Routes.duplicate_report_path(conn, :index))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -56,7 +56,7 @@ defmodule PhilomenaWeb.DuplicateReportController do
|
|||
{:error, _changeset} ->
|
||||
conn
|
||||
|> put_flash(:error, "Failed to submit duplicate report")
|
||||
|> redirect(external: conn.assigns.referrer)
|
||||
|> redirect(to: Routes.image_path(conn, :show, source))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,16 +6,10 @@ defmodule PhilomenaWeb.Filter.SpoilerTypeController do
|
|||
plug PhilomenaWeb.RequireUserPlug
|
||||
|
||||
def update(conn, %{"user" => user_params}) do
|
||||
case Users.update_spoiler_type(conn.assigns.current_user, user_params) do
|
||||
{:ok, user} ->
|
||||
conn
|
||||
|> put_flash(:info, "Changed spoiler type to #{user.spoiler_type}")
|
||||
|> redirect(external: conn.assigns.referrer)
|
||||
{:ok, user} = Users.update_spoiler_type(conn.assigns.current_user, user_params)
|
||||
|
||||
{:error, _changeset} ->
|
||||
conn
|
||||
|> put_flash(:error, "Failed to set spoiler type")
|
||||
|> redirect(external: conn.assigns.referrer)
|
||||
end
|
||||
conn
|
||||
|> put_flash(:info, "Changed spoiler type to #{user.spoiler_type}")
|
||||
|> redirect(external: conn.assigns.referrer)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ defmodule PhilomenaWeb.Image.RandomController do
|
|||
if random_id do
|
||||
redirect(conn, to: Routes.image_path(conn, :show, random_id, scope))
|
||||
else
|
||||
redirect(conn, external: conn.assigns.referrer)
|
||||
redirect(conn, to: Routes.image_path(conn, :index))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ defmodule PhilomenaWeb.Topic.PostController do
|
|||
_error ->
|
||||
conn
|
||||
|> put_flash(:error, "There was an error creating the post")
|
||||
|> redirect(external: conn.assigns.referrer)
|
||||
|> redirect(to: Routes.forum_topic_path(conn, :show, forum, topic))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ defmodule PhilomenaWeb.NotAuthorizedPlug do
|
|||
conn
|
||||
|> Controller.fetch_flash()
|
||||
|> Controller.put_flash(:error, "You can't access that page.")
|
||||
|> Controller.redirect(external: conn.assigns.referrer)
|
||||
|> Controller.redirect(to: "/")
|
||||
|> Conn.halt()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ defmodule PhilomenaWeb.NotFoundPlug do
|
|||
conn
|
||||
|> Controller.fetch_flash()
|
||||
|> Controller.put_flash(:error, "Couldn't find what you were looking for!")
|
||||
|> Controller.redirect(external: conn.assigns.referrer)
|
||||
|> Controller.redirect(to: "/")
|
||||
|> Conn.halt()
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue