redirect to admin path when transitioning user link

This commit is contained in:
byte[] 2020-09-27 22:54:04 -04:00
parent de8622b470
commit 76a1cf8b3a
3 changed files with 6 additions and 14 deletions

View file

@ -13,13 +13,10 @@ defmodule PhilomenaWeb.Admin.UserLink.ContactController do
preload: [:user] preload: [:user]
def create(conn, _params) do def create(conn, _params) do
{:ok, user_link} = {:ok, _} = UserLinks.contact_user_link(conn.assigns.user_link, conn.assigns.current_user)
UserLinks.contact_user_link(conn.assigns.user_link, conn.assigns.current_user)
conn conn
|> put_flash(:info, "User link successfully marked as contacted.") |> put_flash(:info, "User link successfully marked as contacted.")
|> redirect( |> redirect(to: Routes.admin_user_link_path(conn, :index))
to: Routes.profile_user_link_path(conn, :show, conn.assigns.user_link.user, user_link)
)
end end
end end

View file

@ -13,12 +13,10 @@ defmodule PhilomenaWeb.Admin.UserLink.RejectController do
preload: [:user] preload: [:user]
def create(conn, _params) do def create(conn, _params) do
{:ok, user_link} = UserLinks.reject_user_link(conn.assigns.user_link) {:ok, _} = UserLinks.reject_user_link(conn.assigns.user_link)
conn conn
|> put_flash(:info, "User link successfully marked as rejected.") |> put_flash(:info, "User link successfully marked as rejected.")
|> redirect( |> redirect(to: Routes.admin_user_link_path(conn, :index))
to: Routes.profile_user_link_path(conn, :show, conn.assigns.user_link.user, user_link)
)
end end
end end

View file

@ -13,13 +13,10 @@ defmodule PhilomenaWeb.Admin.UserLink.VerificationController do
preload: [:user] preload: [:user]
def create(conn, _params) do def create(conn, _params) do
{:ok, %{user_link: user_link}} = {:ok, _} = UserLinks.verify_user_link(conn.assigns.user_link, conn.assigns.current_user)
UserLinks.verify_user_link(conn.assigns.user_link, conn.assigns.current_user)
conn conn
|> put_flash(:info, "User link successfully verified.") |> put_flash(:info, "User link successfully verified.")
|> redirect( |> redirect(to: Routes.admin_user_link_path(conn, :index))
to: Routes.profile_user_link_path(conn, :show, conn.assigns.user_link.user, user_link)
)
end end
end end