Skip to content

Segments: Only validate segment values for cultures they are defined for (closes #21029)#21033

Merged
kjac merged 11 commits intomainfrom
v17/bugfix/segment-culture-validation
Dec 4, 2025
Merged

Segments: Only validate segment values for cultures they are defined for (closes #21029)#21033
kjac merged 11 commits intomainfrom
v17/bugfix/segment-culture-validation

Conversation

@AndyButland
Copy link
Contributor

@AndyButland AndyButland commented Dec 2, 2025

Prerequisites

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

Addresses: #21029

Description

This PR adds culture-aware segment validation to skip validating property values for segments not defined a culture.

See the linked issue for details of the concern and how to set up to test.

The issue comes as currently we don't look at what segments are defined when validating - we just take the aliases that come from the model. A defined segment though can have one or more cultures defined for it. If at least one culture is defined, the segment can be created only for those cultures. And as such, we shouldn't validate segments that aren't creatable for a culture.

In the first version of this PR I've resolved this by injecting ISegmentService to determine this.

After discussion I've removed this. We currently rely on the incoming model variants and properties to determine the segments, and we can do similar to find the segments along with the cultures they are associated with by looking at what culture and segment combinations are provided.

I've verified that this works for Save, Save and Publish and Publish operations on a document.

There's a small UI issue - that if tackled, should be handled in another PR - in that we still report publishing segments that aren't valid for a culture.

image

Which comes from this code in UmbPublishDocumentEntityAction.

// TODO: show correct variant names instead of variant strings [MR]
localize.list(documentVariants.map((v) => UmbVariantId.Create(v).toString() ?? v.name)),

Copilot AI review requested due to automatic review settings December 2, 2025 16:46
@AndyButland AndyButland changed the title Segments: Only validate segment values for cultures they are defined for. Segments: Only validate segment values for cultures they are defined for (closes #21029) Dec 2, 2025

This comment was marked as outdated.

AndyButland and others added 3 commits December 2, 2025 17:56
@kjac kjac self-assigned this Dec 3, 2025
…es provided in the model to determine segments with cultures.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

@kjac kjac merged commit e6c7ef8 into main Dec 4, 2025
25 of 26 checks passed
@kjac kjac deleted the v17/bugfix/segment-culture-validation branch December 4, 2025 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants