Update edit actions to prevent change other server's data.

dev
KKlochko 2 months ago
parent efbb7e2f46
commit d659d694b0

@ -10,24 +10,51 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.AuthorCard do
def author_card(assigns) do def author_card(assigns) do
~H""" ~H"""
<div class="w-full max-w-sm bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3"> <div class="w-full max-w-sm bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3">
<%= if @current_user != nil and Role.can_moderate?(@current_user.role) do %> <%= if @current_user != nil and Role.can_moderate?(@current_user.role) and is_nil(@author.dbi_server) do %>
<div class="flex justify-end px-4 pt-4"> <div class="flex justify-end px-4 pt-4">
<button id={"dropdownButton#{@author.id}"} data-dropdown-toggle={"dropdown#{@author.id}"} class="inline-block text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:ring-4 focus:outline-none focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-1.5" type="button"> <button
id={"dropdownButton#{@author.id}"}
data-dropdown-toggle={"dropdown#{@author.id}"}
class="inline-block text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:ring-4 focus:outline-none focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-1.5"
type="button"
>
<span class="sr-only">Open dropdown</span> <span class="sr-only">Open dropdown</span>
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 3"> <svg
class="w-5 h-5"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 16 3"
>
<path d="M2 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm6.041 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM14 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Z" /> <path d="M2 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm6.041 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM14 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Z" />
</svg> </svg>
</button> </button>
<!-- Dropdown menu --> <!-- Dropdown menu -->
<div id={"dropdown#{@author.id}"} class="z-10 hidden text-base list-none bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-44 dark:bg-gray-700"> <div
id={"dropdown#{@author.id}"}
class="z-10 hidden text-base list-none bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-44 dark:bg-gray-700"
>
<ul class="py-2" aria-labelledby="dropdownButton"> <ul class="py-2" aria-labelledby="dropdownButton">
<li> <li>
<.link navigate={~p"/authors/#{@author.id}/edit"} <.link
navigate={~p"/authors/#{@author.id}/edit"}
class="flex items-center block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white" class="flex items-center block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white"
> >
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-2 -ml-0.5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> <svg
<path d="M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z"></path> xmlns="http://www.w3.org/2000/svg"
<path fill-rule="evenodd" d="M2 6a2 2 0 012-2h4a1 1 0 010 2H4v10h10v-4a1 1 0 112 0v4a2 2 0 01-2 2H4a2 2 0 01-2-2V6z" clip-rule="evenodd"></path> class="h-4 w-4 mr-2 -ml-0.5"
viewBox="0 0 20 20"
fill="currentColor"
aria-hidden="true"
>
<path d="M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z">
</path>
<path
fill-rule="evenodd"
d="M2 6a2 2 0 012-2h4a1 1 0 010 2H4v10h10v-4a1 1 0 112 0v4a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"
clip-rule="evenodd"
>
</path>
</svg> </svg>
Edit Edit
</.link> </.link>
@ -39,10 +66,26 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.AuthorCard do
<div class="flex flex-col items-center py-5 text-center"> <div class="flex flex-col items-center py-5 text-center">
<.link navigate={~p"/authors/#{@author.id}"}> <.link navigate={~p"/authors/#{@author.id}"}>
<%= if @author.avatar_url != nil do %> <%= if @author.avatar_url != nil do %>
<img class="w-36 h-36 mb-3 rounded-full shadow-lg" src={@author.avatar_url} alt={"#{@author.name} image"} /> <img
class="w-36 h-36 mb-3 rounded-full shadow-lg"
src={@author.avatar_url}
alt={"#{@author.name} image"}
/>
<% else %> <% else %>
<div class="relative w-36 h-36 overflow-hidden bg-gray-100 rounded-full dark:bg-gray-600"> <div class="relative w-36 h-36 overflow-hidden bg-gray-100 rounded-full dark:bg-gray-600">
<svg class="absolute w-36 h-36 text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"></path></svg> <svg
class="absolute w-36 h-36 text-gray-400"
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"
clip-rule="evenodd"
>
</path>
</svg>
</div> </div>
<% end %> <% end %>
</.link> </.link>
@ -50,7 +93,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.AuthorCard do
<.link navigate={~p"/authors/#{@author.id}"}> <.link navigate={~p"/authors/#{@author.id}"}>
<h5 class="mb-1 text-xl font-medium text-gray-900 dark:text-white">{@author.name}</h5> <h5 class="mb-1 text-xl font-medium text-gray-900 dark:text-white">{@author.name}</h5>
</.link> </.link>
<span class="text-sm text-gray-500 dark:text-gray-400">{@author.description}</span> <span class="text-sm text-gray-500 dark:text-gray-400">{@author.brief_description}</span>
</div> </div>
</div> </div>
""" """

@ -10,24 +10,51 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.BookCard do
def book_card(assigns) do def book_card(assigns) do
~H""" ~H"""
<div class="w-full max-w-sm bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3"> <div class="w-full max-w-sm bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3">
<%= if @current_user != nil and Role.can_moderate?(@current_user.role) do %> <%= if @current_user != nil and Role.can_moderate?(@current_user.role) and is_nil(@book.dbi_server) do %>
<div class="flex justify-end px-4 pt-4"> <div class="flex justify-end px-4 pt-4">
<button id={"dropdownButton#{@book.id}"} data-dropdown-toggle={"dropdown#{@book.id}"} class="inline-block text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:ring-4 focus:outline-none focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-1.5" type="button"> <button
id={"dropdownButton#{@book.id}"}
data-dropdown-toggle={"dropdown#{@book.id}"}
class="inline-block text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:ring-4 focus:outline-none focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-1.5"
type="button"
>
<span class="sr-only">Open dropdown</span> <span class="sr-only">Open dropdown</span>
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 3"> <svg
class="w-5 h-5"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 16 3"
>
<path d="M2 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm6.041 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM14 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Z" /> <path d="M2 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm6.041 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM14 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Z" />
</svg> </svg>
</button> </button>
<!-- Dropdown menu --> <!-- Dropdown menu -->
<div id={"dropdown#{@book.id}"} class="z-10 hidden text-base list-none bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-44 dark:bg-gray-700"> <div
id={"dropdown#{@book.id}"}
class="z-10 hidden text-base list-none bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-44 dark:bg-gray-700"
>
<ul class="py-2" aria-labelledby="dropdownButton"> <ul class="py-2" aria-labelledby="dropdownButton">
<li> <li>
<.link navigate={~p"/books/#{@book.id}/edit"} <.link
navigate={~p"/books/#{@book.id}/edit"}
class="flex items-center block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white" class="flex items-center block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white"
> >
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-2 -ml-0.5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> <svg
<path d="M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z"></path> xmlns="http://www.w3.org/2000/svg"
<path fill-rule="evenodd" d="M2 6a2 2 0 012-2h4a1 1 0 010 2H4v10h10v-4a1 1 0 112 0v4a2 2 0 01-2 2H4a2 2 0 01-2-2V6z" clip-rule="evenodd"></path> class="h-4 w-4 mr-2 -ml-0.5"
viewBox="0 0 20 20"
fill="currentColor"
aria-hidden="true"
>
<path d="M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z">
</path>
<path
fill-rule="evenodd"
d="M2 6a2 2 0 012-2h4a1 1 0 010 2H4v10h10v-4a1 1 0 112 0v4a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"
clip-rule="evenodd"
>
</path>
</svg> </svg>
Edit Edit
</.link> </.link>
@ -42,8 +69,20 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.BookCard do
<img class="w-36 mb-3 shadow-lg" src={@book.cover_image_url} alt={"#{@book.title} image"} /> <img class="w-36 mb-3 shadow-lg" src={@book.cover_image_url} alt={"#{@book.title} image"} />
<% else %> <% else %>
<div class="relative w-36 h-36 overflow-hidden"> <div class="relative w-36 h-36 overflow-hidden">
<svg class="w-36 h-36 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24"> <svg
<path fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v15a3 3 0 0 0 3 3h12a1 1 0 1 0 0-2h-2v-2h2a1 1 0 0 0 1-1V4a2 2 0 0 0-2-2h-8v16h5v2H7a1 1 0 1 1 0-2h1V2H6Z" clip-rule="evenodd"/> class="w-36 h-36 text-gray-800 dark:text-white"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="currentColor"
viewBox="0 0 24 24"
>
<path
fill-rule="evenodd"
d="M6 2a2 2 0 0 0-2 2v15a3 3 0 0 0 3 3h12a1 1 0 1 0 0-2h-2v-2h2a1 1 0 0 0 1-1V4a2 2 0 0 0-2-2h-8v16h5v2H7a1 1 0 1 1 0-2h1V2H6Z"
clip-rule="evenodd"
/>
</svg> </svg>
</div> </div>
<% end %> <% end %>
@ -52,7 +91,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.BookCard do
<.link navigate={~p"/books/#{@book.id}"}> <.link navigate={~p"/books/#{@book.id}"}>
<h5 class="mb-1 text-xl font-medium text-gray-900 dark:text-white">{@book.title}</h5> <h5 class="mb-1 text-xl font-medium text-gray-900 dark:text-white">{@book.title}</h5>
</.link> </.link>
<span class="text-sm text-gray-500 dark:text-gray-400">{@book.description}</span> <span class="text-sm text-gray-500 dark:text-gray-400">{@book.brief_description}</span>
</div> </div>
</div> </div>
""" """

@ -34,6 +34,7 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Edit do
socket socket
|> assign(:params, params) |> assign(:params, params)
|> apply_action(socket.assigns.live_action, params) |> apply_action(socket.assigns.live_action, params)
|> redirect_if_not_editable()
{:noreply, socket} {:noreply, socket}
end end
@ -43,7 +44,7 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Edit do
|> assign(:page_title, "Edit Author") |> assign(:page_title, "Edit Author")
|> assign( |> assign(
:author, :author,
Ash.get!(Metadata.Author, id, actor: socket.assigns.current_user) Ash.get!(Metadata.Author, id, load: [:dbi_server], actor: socket.assigns.current_user)
) )
end end
@ -57,4 +58,15 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Edit do
def handle_info({DecentralisedBookIndexWeb.AuthorLive.FormComponent, {:saved, _author}}, socket) do def handle_info({DecentralisedBookIndexWeb.AuthorLive.FormComponent, {:saved, _author}}, socket) do
{:noreply, socket} {:noreply, socket}
end end
defp redirect_if_not_editable(socket) do
if not is_nil(socket.assigns.author.dbi_server) do
socket =
socket
|> Phoenix.LiveView.put_flash(:error, "Can't edit other server's data!")
|> Phoenix.LiveView.redirect(to: ~p"/authors/#{socket.assigns.author}")
else
socket
end
end
end end

@ -63,7 +63,7 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Index do
page = page =
Metadata.search_author!( Metadata.search_author!(
search_query, search_query,
load: [:brief_description], load: [:brief_description, :dbi_server],
query: [sort_input: sort_by], query: [sort_input: sort_by],
page: page_params ++ [count: true], page: page_params ++ [count: true],
actor: socket.assigns.current_user actor: socket.assigns.current_user

@ -15,11 +15,13 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Show do
<.add_button_link patch={~p"/authors/#{@author}/new"}> <.add_button_link patch={~p"/authors/#{@author}/new"}>
Alias Alias
</.add_button_link> </.add_button_link>
<%= if is_nil(@author.dbi_server) do %>
<.link patch={~p"/authors/#{@author}/edit"}> <.link patch={~p"/authors/#{@author}/edit"}>
<.edit_button> <.edit_button>
Edit Edit
</.edit_button> </.edit_button>
</.link> </.link>
<% end %>
</div> </div>
<% end %> <% end %>
</:actions> </:actions>
@ -87,7 +89,7 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Show do
@impl true @impl true
def handle_params(%{"id" => id}, _, socket) do def handle_params(%{"id" => id}, _, socket) do
author = author =
Ash.get!(DecentralisedBookIndex.Metadata.Author, id, actor: socket.assigns.current_user) Ash.get!(DecentralisedBookIndex.Metadata.Author, id, load: [:dbi_server], actor: socket.assigns.current_user)
alternative_names = DecentralisedBookIndex.Metadata.get_author_alternative_names!(author) alternative_names = DecentralisedBookIndex.Metadata.get_author_alternative_names!(author)

@ -28,7 +28,12 @@ defmodule DecentralisedBookIndexWeb.BookLive.Edit do
@impl true @impl true
def handle_params(params, _url, socket) do def handle_params(params, _url, socket) do
{:noreply, apply_action(socket, socket.assigns.live_action, params)} socket =
socket
|> apply_action(socket.assigns.live_action, params)
|> redirect_if_not_editable()
{:noreply, socket}
end end
defp apply_action(socket, :edit, %{"id" => id}) do defp apply_action(socket, :edit, %{"id" => id}) do
@ -36,7 +41,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.Edit do
|> assign(:page_title, "Edit Book") |> assign(:page_title, "Edit Book")
|> assign( |> assign(
:book, :book,
Ash.get!(DecentralisedBookIndex.Metadata.Book, id, actor: socket.assigns.current_user) Ash.get!(DecentralisedBookIndex.Metadata.Book, id, load: [:dbi_server], actor: socket.assigns.current_user)
) )
end end
@ -50,4 +55,15 @@ defmodule DecentralisedBookIndexWeb.BookLive.Edit do
def handle_info({DecentralisedBookIndexWeb.BookLive.FormComponent, {:saved, _book}}, socket) do def handle_info({DecentralisedBookIndexWeb.BookLive.FormComponent, {:saved, _book}}, socket) do
{:noreply, socket} {:noreply, socket}
end end
defp redirect_if_not_editable(socket) do
if not is_nil(socket.assigns.book.dbi_server) do
socket =
socket
|> Phoenix.LiveView.put_flash(:error, "Can't edit other server's data!")
|> Phoenix.LiveView.redirect(to: ~p"/books/#{socket.assigns.book}")
else
socket
end
end
end end

@ -189,7 +189,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.Index do
"title" -> "title" ->
Metadata.search_book!( Metadata.search_book!(
search_query, search_query,
load: [:brief_description], load: [:brief_description, :dbi_server],
query: [sort_input: sort_by], query: [sort_input: sort_by],
page: page_params ++ [count: true], page: page_params ++ [count: true],
actor: actor actor: actor
@ -199,7 +199,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.Index do
Metadata.search_book_by_bid!( Metadata.search_book_by_bid!(
type, type,
search_query, search_query,
load: [:brief_description], load: [:brief_description, :dbi_server],
query: [sort_input: sort_by], query: [sort_input: sort_by],
page: page_params ++ [count: true], page: page_params ++ [count: true],
actor: actor actor: actor

@ -19,11 +19,13 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
<.add_button_link patch={~p"/books/#{@book}/new"}> <.add_button_link patch={~p"/books/#{@book}/new"}>
Edition Edition
</.add_button_link> </.add_button_link>
<%= if is_nil(@book.dbi_server) do %>
<.link patch={~p"/books/#{@book}/edit"}> <.link patch={~p"/books/#{@book}/edit"}>
<.edit_button> <.edit_button>
Edit Edit
</.edit_button> </.edit_button>
</.link> </.link>
<% end %>
</div> </div>
<% end %> <% end %>
</:actions> </:actions>
@ -100,7 +102,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
book = book =
Ash.get!(Metadata.Book, id, Ash.get!(Metadata.Book, id,
actor: socket.assigns.current_user, actor: socket.assigns.current_user,
load: [:bids, :author_roles, :publisher] load: [:bids, :author_roles, :publisher, :dbi_server]
) )
alternative_editions = Metadata.get_book_alternative_editions!(book) alternative_editions = Metadata.get_book_alternative_editions!(book)

@ -30,6 +30,7 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.Edit do
socket socket
|> assign(:params, params) |> assign(:params, params)
|> apply_action(socket.assigns.live_action, params) |> apply_action(socket.assigns.live_action, params)
|> redirect_if_not_editable()
{:noreply, socket} {:noreply, socket}
end end
@ -39,7 +40,7 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.Edit do
|> assign(:page_title, "Edit Publisher") |> assign(:page_title, "Edit Publisher")
|> assign( |> assign(
:publisher, :publisher,
Ash.get!(Metadata.Publisher, id, actor: socket.assigns.current_user) Ash.get!(Metadata.Publisher, id, load: [:dbi_server], actor: socket.assigns.current_user)
) )
end end
@ -56,4 +57,15 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.Edit do
) do ) do
{:noreply, socket} {:noreply, socket}
end end
defp redirect_if_not_editable(socket) do
if not is_nil(socket.assigns.publisher.dbi_server) do
socket =
socket
|> Phoenix.LiveView.put_flash(:error, "Can't edit other server's data!")
|> Phoenix.LiveView.redirect(to: ~p"/publishers/#{socket.assigns.publisher}")
else
socket
end
end
end end

@ -43,7 +43,9 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.Index do
<.link navigate={~p"/publishers/#{publisher}"}>Show</.link> <.link navigate={~p"/publishers/#{publisher}"}>Show</.link>
</div> </div>
<%= if is_nil(publisher.dbi_server) do %>
<.link patch={~p"/publishers/#{publisher}/edit"}>Edit</.link> <.link patch={~p"/publishers/#{publisher}/edit"}>Edit</.link>
<% end %>
</:action> </:action>
</.table> </.table>
@ -76,6 +78,7 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.Index do
search_query, search_query,
query: [sort_input: sort_by], query: [sort_input: sort_by],
page: page_params ++ [count: true], page: page_params ++ [count: true],
load: [:dbi_server],
actor: socket.assigns.current_user actor: socket.assigns.current_user
) )

@ -8,11 +8,13 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.Show do
{@publisher.name} {@publisher.name}
<:actions> <:actions>
<%= if is_nil(@publisher.dbi_server) do %>
<.link patch={~p"/publishers/#{@publisher}/edit"} phx-click={JS.push_focus()}> <.link patch={~p"/publishers/#{@publisher}/edit"} phx-click={JS.push_focus()}>
<.edit_button> <.edit_button>
Edit Edit
</.edit_button> </.edit_button>
</.link> </.link>
<% end %>
</:actions> </:actions>
</.header> </.header>
@ -32,7 +34,7 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.Show do
|> assign(:page_title, page_title(socket.assigns.live_action)) |> assign(:page_title, page_title(socket.assigns.live_action))
|> assign( |> assign(
:publisher, :publisher,
Ash.get!(DecentralisedBookIndex.Metadata.Publisher, id, actor: socket.assigns.current_user) Ash.get!(DecentralisedBookIndex.Metadata.Publisher, id, load: [:dbi_server], actor: socket.assigns.current_user)
)} )}
end end

Loading…
Cancel
Save