-
Notifications
You must be signed in to change notification settings - Fork 1
Usync complete can't synchronised not-published nodes correctly #221
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
Comments
Hi, It is a bug, but the other wat around - uSync.Publisher only syncronised published content, so ideally the default behavior would be the item does not get published at all. i think what is happening is that our PublishedContentHandler, does only deal in published values, but it is syncing the undering content item, and then not setting the properies, ideally it should not publish the item! (you can in theory change the behavior of uSync.Publisher by swapping out the PublishedContentHandler for the normal 'contentHandler' in config - i can dig that out if you need it). |
HI Kevin, |
@KevinJump did you had chance to look and fit bit of configuration which you mentioned? |
Hi, yeah sorry. settings below. "uSync": {
"Publisher": {
"Handlers": {
"DisabledHandlers": [
"PublishedContentHandler",
"ContentTemplateHandler"
]
},
"Settings": {
"IncomingEnabled": true,
"AppId": "YOUR-APP-ID-HERE",
"AppKey": "YOUR-APP-KEY-HERE"
}
}
} So the default (when this isn't set) is to disable the content Handler and ContentTemplateHandler, so the "PublishedContentHandler" manages the content, this swaps that back. the diffrence between the two handlers is small. PublishedHandelr uses the |
Suggestion for when using the PublishedContentHandler, and there are later changes saved for the node, that it would be good to report a warning: The editor confusion is in the message "Completed without any issues at all, nothing to worry about here" Not sure if empty nodes should be created though. |
@KevinJump i had look into this issue and i have idea how to resolve it, but it would require breaking change... You already have method GetPropertyValue(IPropertyValue value) which decide how it synchronizing content, but for published it would be good to have context of item, so we can dynamically check if item is published and than use either item.PublishedValue or item.EditedValue |
there probibly a non-breaking way of adding this, (new method, calls old method by default). I think passing the content item and the options along at the same time would give us the most flexibility. I will take a quick look. |
(v15 version of this commit KevinJump/uSync@0fa8ec0) will also add it back to v13 (but not v14 that is in support only now 🙂) |
I might well also add this functionality as an option in publisher (now we pass it over) - I just need to think of the implications (and whether or not its worth documenting them) *Sometimes it's better to leave the option in code, and then anyone using it will have explicitly understood what they are doing, vs changing an option and getting unexpected results. |
@KevinJump it might be worth do similar things as we done in Translation manager, advance settings where we can do Optional Setting -> Include properties for unpublished content, and than you can modify PublishedContentSerializer to
so it would kept old behaviour as published value if not enabled, but do edited value for unpublished items when enabled? |
yeah that is probably what the published serializer inside complete will end up looking like :) |
hey @KevinJump any eta on solution to this issue? |
yes, i just need to check the status of other things in v13 - I think we should be able to release it this week. |
Has this been fixed in v13? We're using 13.1.7 and the node is created, but content and related media is missing. |
@evans-t it wasn't yet, as workaround you still need use #221 (comment) |
this is a think, i was almost certain i remember doing, and then i can't find the code. from v13.1.9 (Jan 20th 2025), the signature of the e.g
This means you can now override the publihsedSerializer if you want and do as above with your own method. but we didn't change the core behavior which means it still returns the publishedValue. Now i thought we did, but maybe i did and then in testing removed it, so i will need to check, but in principle we could add this to the core behind a setting. |
@KevinJump having it behind setting would be great instead of need maintaining custom versions of handler. but yeah maybe even toggle in ui for editors to decide if they want publish or preview version synced? |
Thank you @bielu and @KevinJump. Love the idea of allowing the editors to decide which version they want! |
We are always a bit reluctant to just add a new option (especially for editors). In an effort to keep things as simple as possible, we might be able to hide it behind some advanced settings or something and see what that looks like. |
@KevinJump I am happy to be your guinea pig with it behind advanced setting as I was on multiple other changes :) |
test version with options (for admin, not for editor). this version adds a couple of options to a server's advance settings.
for reference while testing this is what the protected override object GetPropertyValue(IContent content, IPropertyValue value, SyncSerializerOptions options)
{
// One: Edited value is set, this may or may not be the published value but it will be the latest value
// in the content, but it might then be published on the target, even if it isn't published on the source.
if (options.GetSetting(uSyncExpansions.WellKnownSettings.SendEditedValue, false) is true)
return value.EditedValue;
// Two: simple case (current default), the content is published and at the latest version.
if (content.Published && content.PublishedVersionId == content.VersionId) return value.PublishedValue;
// Three: the "published fallback" setting is false, send published version.
// (this might not be the latest saved version of the content, or for new unpublished content it might be blank/null)
if (options.GetSetting(uSyncExpansions.WellKnownSettings.PublishFallback, false) is false) return value.PublishedValue;
// Four: the content is not published or has a version beyond the published version, send the edited value.
return value.EditedValue;
} the slightly difference with @bielu 's code on this - is we check both if the content is published and if the publishedVersion of the content is the same as the latest version, if they are not then there is a chance the values have been updated but not yet published so we use them. (i.e.. content.Published will return true when version 19 is published but version 20 has been created but not published) |
@KevinJump Just checking in to see if there's any an estimated timeline for this to be released. Thanks |
Describe the bug
Bug is related to synchronization of unpublished content, which was never published.
Version (please complete the following information):
To Reproduce
Steps to reproduce the behavior:
1.Create node, add block editor, add content, save but not publish
2. try to synchronised it to other server
Current result
Node was created in other server, but was missing all properties!
Expected behavior
Node is created in other server with all properties.
The text was updated successfully, but these errors were encountered: