Allow us to not raise saving events for sorting nodes through Contentservice #15630
Closed
jemayn
started this conversation in
Features and ideas
Replies: 1 comment 1 reply
-
You can suppress notifications on your scope. using var scope = _coreScopeProvider.CreateCoreScope();
using(scope.Notifications.Suppress()){
_contentService.Sort(sortedSiblings);
}
scope.Complete();
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a case where the user wants new nodes in a tree to automatically be added to the top of the parents sortorder.
I thought I could just add a ContentSavedNotification that does something like this:
However, the contentService.Sort method: https://github.com/umbraco/Umbraco-CMS/blob/contrib/src/Umbraco.Core/Services/ContentService.cs#L2849
Ends up sending another saving event:
https://github.com/umbraco/Umbraco-CMS/blob/contrib/src/Umbraco.Core/Services/ContentService.cs#L2951
So if we have other contentSaving notification handlers then they are triggered for all nodes in the tree.
Not sure when it changed, but in the past it was optional if we wanted to raise events or not: https://github.com/umbraco/Umbraco-CMS/blob/release-8.18.12/src/Umbraco.Core/Services/Implement/ContentService.cs#L2338
So would it be possible to add that back? Or atleast have some sort of eventmessages we could look at that would tell us it was from the sorting in the contentsaving event? - As right now they are empty:
Beta Was this translation helpful? Give feedback.
All reactions