fix credo warning for is_already_admin?

This commit is contained in:
shibao 2024-02-23 22:16:08 -05:00
parent 7cd9dca958
commit c892b5449b
2 changed files with 6 additions and 6 deletions

View File

@ -422,16 +422,16 @@ defmodule Memex.Accounts do
## Examples
iex> is_already_admin?(%User{role: :admin})
iex> already_admin?(%User{role: :admin})
true
iex> is_already_admin?(%User{})
iex> already_admin?(%User{})
false
"""
@spec is_already_admin?(User.t() | nil) :: boolean()
def is_already_admin?(%User{role: :admin}), do: true
def is_already_admin?(_invalid_user), do: false
@spec already_admin?(User.t() | nil) :: boolean()
def already_admin?(%User{role: :admin}), do: true
def already_admin?(_invalid_user), do: false
## Confirmation

View File

@ -38,7 +38,7 @@
<li class="mx-2 my-1 border-left border border-primary-700"></li>
<%= 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">
<%= gettext("invites") %>
</.link>