def handle(%{data: %{"type" => "Undo", "object" => undone_object}} = object, meta) do
with undone_object <- Activity.get_by_ap_id(undone_object),
:ok <- handle_undoing(undone_object) do
+ meta =
+ meta
+ |> Keyword.put(:embedded_object, undone_object.data)
+
{:ok, object, meta}
end
end
}
end
- test "deletes the original block", %{block_undo: block_undo, block: block} do
- {:ok, _block_undo, _} = SideEffects.handle(block_undo)
+ test "deletes the original block, but sets `embedded_object`", %{
+ block_undo: block_undo,
+ block: block
+ } do
+ {:ok, _block_undo, meta} = SideEffects.handle(block_undo)
+
+ assert meta[:embedded_object] == block.data
refute Activity.get_by_id(block.id)
end