fix credo check for is_already_admin?
This commit is contained in:
parent
27cda3733e
commit
5d146ce6af
@ -421,16 +421,16 @@ defmodule Cannery.Accounts do
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> is_already_admin?(%User{role: :admin})
|
iex> already_admin?(%User{role: :admin})
|
||||||
true
|
true
|
||||||
|
|
||||||
iex> is_already_admin?(%User{})
|
iex> already_admin?(%User{})
|
||||||
false
|
false
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec is_already_admin?(User.t() | nil) :: boolean()
|
@spec already_admin?(User.t() | nil) :: boolean()
|
||||||
def is_already_admin?(%User{role: :admin}), do: true
|
def already_admin?(%User{role: :admin}), do: true
|
||||||
def is_already_admin?(_invalid_user), do: false
|
def already_admin?(_invalid_user), do: false
|
||||||
|
|
||||||
## Confirmation
|
## Confirmation
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
<%= gettext("Range") %>
|
<%= gettext("Range") %>
|
||||||
</.link>
|
</.link>
|
||||||
</li>
|
</li>
|
||||||
<li :if={@current_user |> Accounts.is_already_admin?()} class="mx-2 my-1">
|
<li :if={@current_user |> Accounts.already_admin?()} class="mx-2 my-1">
|
||||||
<.link navigate={~p"/invites"} class="text-white hover:underline">
|
<.link navigate={~p"/invites"} class="text-white hover:underline">
|
||||||
<%= gettext("Invites") %>
|
<%= gettext("Invites") %>
|
||||||
</.link>
|
</.link>
|
||||||
@ -70,7 +70,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
:if={
|
:if={
|
||||||
@current_user |> Accounts.is_already_admin?() and
|
@current_user |> Accounts.already_admin?() and
|
||||||
function_exported?(Routes, :live_dashboard_path, 2)
|
function_exported?(Routes, :live_dashboard_path, 2)
|
||||||
}
|
}
|
||||||
class="mx-2 my-1"
|
class="mx-2 my-1"
|
||||||
|
Loading…
Reference in New Issue
Block a user