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]
def create(conn, _params) do
{:ok, user_link} =
UserLinks.contact_user_link(conn.assigns.user_link, conn.assigns.current_user)
{:ok, _} = UserLinks.contact_user_link(conn.assigns.user_link, conn.assigns.current_user)
conn
|> put_flash(:info, "User link successfully marked as contacted.")
|> redirect(
to: Routes.profile_user_link_path(conn, :show, conn.assigns.user_link.user, user_link)
)
|> redirect(to: Routes.admin_user_link_path(conn, :index))
end
end

View file

@ -13,12 +13,10 @@ defmodule PhilomenaWeb.Admin.UserLink.RejectController do
preload: [:user]
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
|> put_flash(:info, "User link successfully marked as rejected.")
|> redirect(
to: Routes.profile_user_link_path(conn, :show, conn.assigns.user_link.user, user_link)
)
|> redirect(to: Routes.admin_user_link_path(conn, :index))
end
end

View file

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