Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix node and subtree restoration #659

Merged
merged 3 commits into from
Dec 20, 2024
Merged

Conversation

sBouzols
Copy link
Contributor

fix(): When restoring a subtree, do not send a nodeCreated notifica…tion for each nodes in the subtree but a single notification to insertSubtree and all its children.

fix(): RestoreNode now use the InsertMode.CHILD to add a new branch instead of trying to insert a node between the parent and already existing children. It causes unexpected behaviors.

…tion for each nodes in the subtree but a single notification to `insertSubtree` and all its children.

fix(): RestoreNode now use the `InsertMode.CHILD` to add a new branch instead of trying to insert a node between the parent and already existing children.
It causes unexpected behaviors.

Signed-off-by: sBouzols <[email protected]>
Copy link
Contributor

@EstherDarkish EstherDarkish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test OK Code OK

@@ -590,8 +590,13 @@ public void restoreNode(UUID studyId, List<UUID> nodeIds, UUID anchorNodeId) {
nodeToRestore.setStashed(false);
nodeToRestore.setStashDate(null);
nodesRepository.save(nodeToRestore);
notificationService.emitNodeInserted(studyId, anchorNodeId, nodeId, InsertMode.AFTER, anchorNodeId);
restoreNodeChildren(studyId, nodeId);
boolean hasChildren = nodesRepository.countByParentNodeIdNode(nodeId) > 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create an private method hasChildren to reuse it for other usages

@@ -725,15 +725,15 @@ private void stashNode(UUID studyUuid, AbstractNode child, boolean stashChildren
assertTrue(expectedStash.stream().anyMatch(node -> node.getId().equals(id))));
}

private void restoreNode(UUID studyUuid, List<UUID> nodeId, UUID anchorNodeId, Set<UUID> expectedIdRestored, String userId) throws Exception {
private void restoreNode(UUID studyUuid, List<UUID> nodeId, UUID anchorNodeId, String userId) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename by nodeIds

Signed-off-by: Slimane AMAR <[email protected]>
@SlimaneAmar SlimaneAmar merged commit 49f6989 into main Dec 20, 2024
4 checks passed
@SlimaneAmar SlimaneAmar deleted the fix_restore_node_and_subtree branch December 20, 2024 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants