fix credo warning for is_already_admin?
This commit is contained in:
parent
7cd9dca958
commit
c892b5449b
@ -422,16 +422,16 @@ defmodule Memex.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
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
<li class="mx-2 my-1 border-left border border-primary-700"></li>
|
<li class="mx-2 my-1 border-left border border-primary-700"></li>
|
||||||
|
|
||||||
<%= if @current_user do %>
|
<%= if @current_user do %>
|
||||||
<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-primary-400 hover:underline">
|
<.link navigate={~p"/invites"} class="text-primary-400 hover:underline">
|
||||||
<%= gettext("invites") %>
|
<%= gettext("invites") %>
|
||||||
</.link>
|
</.link>
|
||||||
|
Loading…
Reference in New Issue
Block a user