-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
…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]>
There was a problem hiding this 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; |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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]>
Quality Gate passedIssues Measures |
fix(): When restoring a subtree, do not send a
nodeCreated
notifica…tion for each nodes in the subtree but a single notification toinsertSubtree
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.