diff --git a/lib/memex/contexts.ex b/lib/memex/contexts.ex index de282dc..9203314 100644 --- a/lib/memex/contexts.ex +++ b/lib/memex/contexts.ex @@ -234,7 +234,7 @@ defmodule Memex.Contexts do def owner_or_admin?(_context, %{role: :admin}), do: true def owner_or_admin?(_context, _other_user), do: false - @spec is_owner?(Context.t(), User.t()) :: boolean() - def is_owner?(%{user_id: user_id}, %{id: user_id}), do: true - def is_owner?(_context, _other_user), do: false + @spec owner?(Context.t(), User.t()) :: boolean() + def owner?(%{user_id: user_id}, %{id: user_id}), do: true + def owner?(_context, _other_user), do: false end diff --git a/lib/memex/notes.ex b/lib/memex/notes.ex index f9fa677..b216ac0 100644 --- a/lib/memex/notes.ex +++ b/lib/memex/notes.ex @@ -234,7 +234,7 @@ defmodule Memex.Notes do def owner_or_admin?(_context, %{role: :admin}), do: true def owner_or_admin?(_context, _other_user), do: false - @spec is_owner?(Note.t(), User.t()) :: boolean() - def is_owner?(%{user_id: user_id}, %{id: user_id}), do: true - def is_owner?(_context, _other_user), do: false + @spec owner?(Note.t(), User.t()) :: boolean() + def owner?(%{user_id: user_id}, %{id: user_id}), do: true + def owner?(_context, _other_user), do: false end diff --git a/lib/memex/pipelines.ex b/lib/memex/pipelines.ex index bbcd3bf..2d60596 100644 --- a/lib/memex/pipelines.ex +++ b/lib/memex/pipelines.ex @@ -236,7 +236,7 @@ defmodule Memex.Pipelines do def owner_or_admin?(_context, %{role: :admin}), do: true def owner_or_admin?(_context, _other_user), do: false - @spec is_owner?(Pipeline.t(), User.t()) :: boolean() - def is_owner?(%{user_id: user_id}, %{id: user_id}), do: true - def is_owner?(_context, _other_user), do: false + @spec owner?(Pipeline.t(), User.t()) :: boolean() + def owner?(%{user_id: user_id}, %{id: user_id}), do: true + def owner?(_context, _other_user), do: false end diff --git a/lib/memex_web/live/context_live/index.html.heex b/lib/memex_web/live/context_live/index.html.heex index e9542e6..02a0308 100644 --- a/lib/memex_web/live/context_live/index.html.heex +++ b/lib/memex_web/live/context_live/index.html.heex @@ -33,7 +33,7 @@ > <:actions :let={context}> <.link - :if={Contexts.is_owner?(context, @current_user)} + :if={Contexts.owner?(context, @current_user)} patch={~p"/contexts/#{context}/edit"} aria-label={dgettext("actions", "edit %{context_slug}", context_slug: context.slug)} > diff --git a/lib/memex_web/live/context_live/show.html.heex b/lib/memex_web/live/context_live/show.html.heex index 35a5ef1..2e1d9a0 100644 --- a/lib/memex_web/live/context_live/show.html.heex +++ b/lib/memex_web/live/context_live/show.html.heex @@ -17,7 +17,7 @@
<.link - :if={Contexts.is_owner?(@context, @current_user)} + :if={Contexts.owner?(@context, @current_user)} class="btn btn-primary" patch={~p"/context/#{@context}/edit"} > diff --git a/lib/memex_web/live/note_live/index.html.heex b/lib/memex_web/live/note_live/index.html.heex index 1accbf8..1d2a473 100644 --- a/lib/memex_web/live/note_live/index.html.heex +++ b/lib/memex_web/live/note_live/index.html.heex @@ -33,7 +33,7 @@ > <:actions :let={note}> <.link - :if={Notes.is_owner?(note, @current_user)} + :if={Notes.owner?(note, @current_user)} patch={~p"/notes/#{note}/edit"} aria-label={dgettext("actions", "edit %{note_slug}", note_slug: note.slug)} > diff --git a/lib/memex_web/live/note_live/show.html.heex b/lib/memex_web/live/note_live/show.html.heex index beca4a4..c88c65a 100644 --- a/lib/memex_web/live/note_live/show.html.heex +++ b/lib/memex_web/live/note_live/show.html.heex @@ -17,7 +17,7 @@
<.link - :if={Notes.is_owner?(@note, @current_user)} + :if={Notes.owner?(@note, @current_user)} class="btn btn-primary" patch={~p"/note/#{@note}/edit"} > diff --git a/lib/memex_web/live/pipeline_live/index.html.heex b/lib/memex_web/live/pipeline_live/index.html.heex index 474d708..f2a8288 100644 --- a/lib/memex_web/live/pipeline_live/index.html.heex +++ b/lib/memex_web/live/pipeline_live/index.html.heex @@ -33,7 +33,7 @@ > <:actions :let={pipeline}> <.link - :if={Pipelines.is_owner?(pipeline, @current_user)} + :if={Pipelines.owner?(pipeline, @current_user)} patch={~p"/pipelines/#{pipeline}/edit"} aria-label={dgettext("actions", "edit %{pipeline_slug}", pipeline_slug: pipeline.slug)} > diff --git a/lib/memex_web/live/pipeline_live/show.html.heex b/lib/memex_web/live/pipeline_live/show.html.heex index 47535f0..f32418e 100644 --- a/lib/memex_web/live/pipeline_live/show.html.heex +++ b/lib/memex_web/live/pipeline_live/show.html.heex @@ -17,7 +17,7 @@
<.link - :if={Pipelines.is_owner?(@pipeline, @current_user)} + :if={Pipelines.owner?(@pipeline, @current_user)} class="btn btn-primary" patch={~p"/pipeline/#{@pipeline}/edit"} > @@ -52,7 +52,7 @@ <%= gettext("%{position}. %{title}", position: position + 1, title: title) %> - <%= if Pipelines.is_owner?(@pipeline, @current_user) do %> + <%= if Pipelines.owner?(@pipeline, @current_user) do %>
<%= if position <= 0 do %> @@ -113,7 +113,7 @@ <% end %> <.link - :if={Pipelines.is_owner?(@pipeline, @current_user)} + :if={Pipelines.owner?(@pipeline, @current_user)} class="self-end btn btn-primary" patch={~p"/pipeline/#{@pipeline}/add_step"} >