Skip to content

Conversation

@kjac
Copy link
Contributor

@kjac kjac commented Apr 23, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

Description

#19060 enables editing segmented documents. At least - to a point. The server-side modelling for document create and update operations do not fully support segments; specifically, the service layer struggle with properties that only varies by either culture or segment for doctypes with both culture and segment variance enabled.

There is no subtle fix here - we need to break things 😞

With this PR, the service layer models now align more with the API request models, which they probably should have done from the beginning.

This means that the InvariantName and InvariantProperties have been removed from the create/update models, and likewise the Properties collection on the variant models.

To replace these:

  1. The "invariant variant" must now be declared as part of the Variants collection, with null values for Culture and Segment.
  2. A new Properties collection has been introduced on the create/update models. This collection now holds both the invariant and variant properties.

Testing this PR

Test that any combination of invariance, culture and segment variance can be created and edited - that is:

  • Fully invariant documents.
  • Culture-only variant documents.
  • Segment-only variant documents.
  • Culture and segment variant documents with
    • Invariant properties
    • Culture-only variant properties
    • Segment-only variant properties
    • Culture and segment variant properties

Retrofitting custom code to counter the breakage

If you're using any of the "new" content editing services from V14 (IContentEditingService, IMediaEditingService, IMemberEditingService) you will likely be affected by these changes.

When managing invariant content, you'll need to add an "invariant variant" (with null values for Culture and Segment) to the Variants collection on the create/update models, instead of using InvariantName and InvariantProperties (which have been removed).

Any and all properties (both invariant and variant) go into the newly introduced Properties collection on the create/update models. Notice that the PropertyValueModel now features Culture and Segment properties for variant property values.

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

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

Just a couple of comments for consideration from visual inspection - I'll move on now to testing.

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

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

Creating, editing and saving all seems to work as expected. Have tested creation and update of the following content:

  • Fully invariant documents - ✅
  • Culture-only variant documents - ✅
  • Segment-only variant documents - ✅
  • Culture and segment variant documents with
    • Invariant properties - ✅
    • Culture-only variant properties - ✅
    • Segment-only variant properties- ✅
    • Culture and segment variant properties - ✅

I found the following small issues:

  1. When publishing segmented content, we get these messages, which are a little weird. Should probably use the segment names if we could (like we would have the language names for culture variant content). If I understand correctly, we don't actually independently publish segments like we do cultures? If that's the case, probably shouldn't mention the segments at all.

image

Similarly for culture and segment variant:

image

  1. Status lozenges in the content editor aren't quite right. E.g. for this setup:

image

In the content section the first two are indicated as "Shared" with no indication on the third.
Then when you edit a particular segment, the third has a "Shared across culture" indication (and not, as you'd expect, "Shared across segments").

@kjac
Copy link
Contributor Author

kjac commented Apr 23, 2025

Thanks for testing @AndyButland 👍

I'll add some follow-up tasks to amend your findings, unless you find them blocking enough to postpone merging this PR in?

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

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

No, as discussed these are fine to consider as later improvements.

@kjac kjac merged commit 2cf2827 into v16/dev Apr 23, 2025
24 of 25 checks passed
@kjac kjac deleted the v15/feature/select-segment-serverside-refactor branch April 23, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants