fix visibility issues with multiple users

This commit is contained in:
2025-02-15 04:24:53 +00:00
parent 3e686fa199
commit 6c2aba84ef
32 changed files with 187 additions and 413 deletions

View File

@ -1,4 +1,4 @@
<div class="mx-auto flex flex-col justify-center items-start space-y-4 max-w-3xl">
<div class="flex flex-col justify-center items-start mx-auto space-y-4 max-w-3xl">
<h1 class="text-xl">
<%= gettext("notes") %>
</h1>
@ -9,7 +9,7 @@
as={:search}
phx-change="search"
phx-submit="search"
class="self-stretch flex flex-col items-stretch"
class="flex flex-col items-stretch self-stretch"
>
<%= text_input(f, :search_term,
class: "input input-primary",
@ -33,14 +33,14 @@
>
<:actions :let={note}>
<.link
:if={Notes.owner?(note, @current_user)}
:if={@current_user}
patch={~p"/notes/#{note}/edit"}
aria-label={dgettext("actions", "edit %{note_slug}", note_slug: note.slug)}
>
<%= dgettext("actions", "edit") %>
</.link>
<.link
:if={Notes.owner_or_admin?(note, @current_user)}
:if={@current_user}
href="#"
phx-click="delete"
phx-value-id={note.id}

View File

@ -1,4 +1,4 @@
<div class="mx-auto flex flex-col justify-center items-stretch space-y-4 max-w-3xl">
<div class="flex flex-col justify-center items-stretch mx-auto space-y-4 max-w-3xl">
<h1 class="text-xl">
<%= @note.slug %>
</h1>
@ -15,16 +15,12 @@
<%= gettext("Visibility: %{visibility}", visibility: @note.visibility) %>
</p>
<div class="self-end flex space-x-4">
<.link
:if={Notes.owner?(@note, @current_user)}
class="btn btn-primary"
patch={~p"/note/#{@note}/edit"}
>
<div class="flex self-end space-x-4">
<.link :if={@current_user} class="btn btn-primary" patch={~p"/note/#{@note}/edit"}>
<%= dgettext("actions", "edit") %>
</.link>
<button
:if={Notes.owner_or_admin?(@note, @current_user)}
:if={@current_user}
type="button"
class="btn btn-primary"
phx-click="delete"