From d495db0bb3744d3281b911c022ddd316833c1b68 Mon Sep 17 00:00:00 2001 From: shibao Date: Sun, 19 Mar 2023 00:26:37 -0400 Subject: [PATCH] remove unnecessary auth check on invite page --- lib/memex_web/live/invite_live/index.ex | 14 ++------------ priv/gettext/de/LC_MESSAGES/default.po | 6 +++--- priv/gettext/de/LC_MESSAGES/errors.po | 5 ----- priv/gettext/de/LC_MESSAGES/prompts.po | 12 ++++++------ priv/gettext/default.pot | 6 +++--- priv/gettext/en/LC_MESSAGES/default.po | 6 +++--- priv/gettext/en/LC_MESSAGES/errors.po | 5 ----- priv/gettext/en/LC_MESSAGES/prompts.po | 12 ++++++------ priv/gettext/errors.pot | 5 ----- priv/gettext/prompts.pot | 12 ++++++------ 10 files changed, 29 insertions(+), 54 deletions(-) diff --git a/lib/memex_web/live/invite_live/index.ex b/lib/memex_web/live/invite_live/index.ex index 680b293..345ecfa 100644 --- a/lib/memex_web/live/invite_live/index.ex +++ b/lib/memex_web/live/invite_live/index.ex @@ -6,21 +6,11 @@ defmodule MemexWeb.InviteLive.Index do use MemexWeb, :live_view alias Memex.Accounts alias Memex.Accounts.{Invite, Invites} - alias MemexWeb.HomeLive alias Phoenix.LiveView.JS @impl true - def mount(_params, _session, %{assigns: %{current_user: current_user}} = socket) do - socket = - if current_user |> Map.get(:role) == :admin do - socket |> display_invites() - else - prompt = dgettext("errors", "you are not authorized to view this page") - return_to = Routes.live_path(Endpoint, HomeLive) - socket |> put_flash(:error, prompt) |> push_redirect(to: return_to) - end - - {:ok, socket} + def mount(_params, _session, socket) do + {:ok, socket |> display_invites()} end @impl true diff --git a/priv/gettext/de/LC_MESSAGES/default.po b/priv/gettext/de/LC_MESSAGES/default.po index c6dc8f5..b77821c 100644 --- a/priv/gettext/de/LC_MESSAGES/default.po +++ b/priv/gettext/de/LC_MESSAGES/default.po @@ -99,7 +99,7 @@ msgstr "" msgid "document your processes, attaching contexts to each step" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:33 +#: lib/memex_web/live/invite_live/index.ex:23 #, elixir-autogen, elixir-format msgid "edit invite" msgstr "" @@ -154,7 +154,7 @@ msgid "invite only" msgstr "" #: lib/memex_web/components/core_components/topbar.html.heex:58 -#: lib/memex_web/live/invite_live/index.ex:41 +#: lib/memex_web/live/invite_live/index.ex:31 #: lib/memex_web/live/invite_live/index.html.heex:3 #, elixir-autogen, elixir-format msgid "invites" @@ -170,7 +170,7 @@ msgstr "" msgid "multi-user:" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:37 +#: lib/memex_web/live/invite_live/index.ex:27 #, elixir-autogen, elixir-format msgid "new invite" msgstr "" diff --git a/priv/gettext/de/LC_MESSAGES/errors.po b/priv/gettext/de/LC_MESSAGES/errors.po index 5f1e86a..abb78ca 100644 --- a/priv/gettext/de/LC_MESSAGES/errors.po +++ b/priv/gettext/de/LC_MESSAGES/errors.po @@ -122,11 +122,6 @@ msgstr "" msgid "sorry, this invite was not found or expired" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:18 -#, elixir-autogen, elixir-format, fuzzy -msgid "you are not authorized to view this page" -msgstr "" - #: lib/memex_web/controllers/user_settings_controller.ex:84 #, elixir-autogen, elixir-format, fuzzy msgid "email change link is invalid or it has expired." diff --git a/priv/gettext/de/LC_MESSAGES/prompts.po b/priv/gettext/de/LC_MESSAGES/prompts.po index 177294d..4a5bff3 100644 --- a/priv/gettext/de/LC_MESSAGES/prompts.po +++ b/priv/gettext/de/LC_MESSAGES/prompts.po @@ -15,27 +15,27 @@ msgstr "" msgid "%{email} confirmed successfully." msgstr "" -#: lib/memex_web/live/invite_live/index.ex:53 +#: lib/memex_web/live/invite_live/index.ex:43 #, elixir-autogen, elixir-format msgid "%{invite_name} deleted succesfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:114 +#: lib/memex_web/live/invite_live/index.ex:104 #, elixir-autogen, elixir-format msgid "%{invite_name} disabled succesfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:90 +#: lib/memex_web/live/invite_live/index.ex:80 #, elixir-autogen, elixir-format msgid "%{invite_name} enabled succesfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:68 +#: lib/memex_web/live/invite_live/index.ex:58 #, elixir-autogen, elixir-format msgid "%{invite_name} updated succesfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:136 +#: lib/memex_web/live/invite_live/index.ex:126 #, elixir-autogen, elixir-format msgid "%{user_email} deleted succesfully" msgstr "" @@ -116,7 +116,7 @@ msgstr "" msgid "%{name} updated successfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:126 +#: lib/memex_web/live/invite_live/index.ex:116 #, elixir-autogen, elixir-format, fuzzy msgid "copied to clipboard" msgstr "" diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 3c7f185..af6cd2a 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -97,7 +97,7 @@ msgstr "" msgid "document your processes, attaching contexts to each step" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:33 +#: lib/memex_web/live/invite_live/index.ex:23 #, elixir-autogen, elixir-format msgid "edit invite" msgstr "" @@ -152,7 +152,7 @@ msgid "invite only" msgstr "" #: lib/memex_web/components/core_components/topbar.html.heex:58 -#: lib/memex_web/live/invite_live/index.ex:41 +#: lib/memex_web/live/invite_live/index.ex:31 #: lib/memex_web/live/invite_live/index.html.heex:3 #, elixir-autogen, elixir-format msgid "invites" @@ -168,7 +168,7 @@ msgstr "" msgid "multi-user:" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:37 +#: lib/memex_web/live/invite_live/index.ex:27 #, elixir-autogen, elixir-format msgid "new invite" msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index 3f3aa47..064fbb9 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -98,7 +98,7 @@ msgstr "" msgid "document your processes, attaching contexts to each step" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:33 +#: lib/memex_web/live/invite_live/index.ex:23 #, elixir-autogen, elixir-format msgid "edit invite" msgstr "" @@ -153,7 +153,7 @@ msgid "invite only" msgstr "" #: lib/memex_web/components/core_components/topbar.html.heex:58 -#: lib/memex_web/live/invite_live/index.ex:41 +#: lib/memex_web/live/invite_live/index.ex:31 #: lib/memex_web/live/invite_live/index.html.heex:3 #, elixir-autogen, elixir-format msgid "invites" @@ -169,7 +169,7 @@ msgstr "" msgid "multi-user:" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:37 +#: lib/memex_web/live/invite_live/index.ex:27 #, elixir-autogen, elixir-format msgid "new invite" msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/errors.po b/priv/gettext/en/LC_MESSAGES/errors.po index 9ece1fa..d94cac3 100644 --- a/priv/gettext/en/LC_MESSAGES/errors.po +++ b/priv/gettext/en/LC_MESSAGES/errors.po @@ -123,11 +123,6 @@ msgstr "" msgid "sorry, this invite was not found or expired" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:18 -#, elixir-autogen, elixir-format -msgid "you are not authorized to view this page" -msgstr "" - #: lib/memex_web/controllers/user_settings_controller.ex:84 #, elixir-autogen, elixir-format msgid "email change link is invalid or it has expired." diff --git a/priv/gettext/en/LC_MESSAGES/prompts.po b/priv/gettext/en/LC_MESSAGES/prompts.po index dc7d31d..340c453 100644 --- a/priv/gettext/en/LC_MESSAGES/prompts.po +++ b/priv/gettext/en/LC_MESSAGES/prompts.po @@ -16,27 +16,27 @@ msgstr "" msgid "%{email} confirmed successfully." msgstr "" -#: lib/memex_web/live/invite_live/index.ex:53 +#: lib/memex_web/live/invite_live/index.ex:43 #, elixir-autogen, elixir-format msgid "%{invite_name} deleted succesfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:114 +#: lib/memex_web/live/invite_live/index.ex:104 #, elixir-autogen, elixir-format msgid "%{invite_name} disabled succesfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:90 +#: lib/memex_web/live/invite_live/index.ex:80 #, elixir-autogen, elixir-format msgid "%{invite_name} enabled succesfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:68 +#: lib/memex_web/live/invite_live/index.ex:58 #, elixir-autogen, elixir-format msgid "%{invite_name} updated succesfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:136 +#: lib/memex_web/live/invite_live/index.ex:126 #, elixir-autogen, elixir-format msgid "%{user_email} deleted succesfully" msgstr "" @@ -117,7 +117,7 @@ msgstr "" msgid "%{name} updated successfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:126 +#: lib/memex_web/live/invite_live/index.ex:116 #, elixir-autogen, elixir-format msgid "copied to clipboard" msgstr "" diff --git a/priv/gettext/errors.pot b/priv/gettext/errors.pot index 8de15b7..5d2fd53 100644 --- a/priv/gettext/errors.pot +++ b/priv/gettext/errors.pot @@ -122,11 +122,6 @@ msgstr "" msgid "sorry, this invite was not found or expired" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:18 -#, elixir-autogen, elixir-format -msgid "you are not authorized to view this page" -msgstr "" - #: lib/memex_web/controllers/user_settings_controller.ex:84 #, elixir-autogen, elixir-format msgid "email change link is invalid or it has expired." diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot index 911bc93..7111dab 100644 --- a/priv/gettext/prompts.pot +++ b/priv/gettext/prompts.pot @@ -15,27 +15,27 @@ msgstr "" msgid "%{email} confirmed successfully." msgstr "" -#: lib/memex_web/live/invite_live/index.ex:53 +#: lib/memex_web/live/invite_live/index.ex:43 #, elixir-autogen, elixir-format msgid "%{invite_name} deleted succesfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:114 +#: lib/memex_web/live/invite_live/index.ex:104 #, elixir-autogen, elixir-format msgid "%{invite_name} disabled succesfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:90 +#: lib/memex_web/live/invite_live/index.ex:80 #, elixir-autogen, elixir-format msgid "%{invite_name} enabled succesfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:68 +#: lib/memex_web/live/invite_live/index.ex:58 #, elixir-autogen, elixir-format msgid "%{invite_name} updated succesfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:136 +#: lib/memex_web/live/invite_live/index.ex:126 #, elixir-autogen, elixir-format msgid "%{user_email} deleted succesfully" msgstr "" @@ -116,7 +116,7 @@ msgstr "" msgid "%{name} updated successfully" msgstr "" -#: lib/memex_web/live/invite_live/index.ex:126 +#: lib/memex_web/live/invite_live/index.ex:116 #, elixir-autogen, elixir-format msgid "copied to clipboard" msgstr ""