Skip to content

Commit

Permalink
[BUG FIX] [TOR-9] [MER-2793] Fix move_item event handling in PagesView
Browse files Browse the repository at this point in the history
[BUG FIX] [TOR-9] [MER-2793] Fix move_item event handling in PagesView
  • Loading branch information
darrensiegel committed Dec 5, 2023
2 parents 0276e98 + 0be6c66 commit 4ccf87b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/oli_web/live/resources/pages_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -532,17 +532,23 @@ defmodule OliWeb.Resources.PagesView do

def handle_event(
"MoveModal.move_item",
%{"uuid" => uuid, "to_uuid" => to_uuid, "from_uuid" => from_uuid},
%{"to_uuid" => to_uuid} = params,
socket
) do
%{
author: author,
project: project,
modal_assigns: %{hierarchy: hierarchy}
modal_assigns: %{node: node, hierarchy: hierarchy}
} = socket.assigns

%{revision: revision} = Hierarchy.find_in_hierarchy(hierarchy, uuid)
%{revision: from_container} = Hierarchy.find_in_hierarchy(hierarchy, from_uuid)
%{revision: revision} = node

%{revision: from_container} =
case params["from_uuid"] do
nil -> %{revision: nil}
from_uuid -> Hierarchy.find_in_hierarchy(hierarchy, from_uuid)
end

%{revision: to_container} = Hierarchy.find_in_hierarchy(hierarchy, to_uuid)

{:ok, _} = ContainerEditor.move_to(revision, from_container, to_container, author, project)
Expand Down

0 comments on commit 4ccf87b

Please sign in to comment.