Refact CopySupport._normalize_ids_after_copy for better STATE_NEW handling with activated workflow #444
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On activated workflow copy/paste-inserted objects shall not be visible. That is why the get the status "NEW". If pageelements are inserted into a page, the current page-node shall get the status changed, and the new pagelements the status "NEW". If a document (tree) is inserted the inserted page-like objects shall get the status "NEW" to prevent them being published instantly. The pages subordinated pageelements are not set to "NEW" because
Hint: This STATUS_NEW settting does not happen if the workflow is deaktivated; here the copied nodes are instantly visible.
Moreover the code change tries to add some Py best practices:
The function normalize_ids_after_copy() gets 2. more parameter (
is_initial_node=True, processed_nodes=None) to differ the recursion-case (tree-inserting) and avoid multiple onObjChange-events.References: