Skip to content
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

when propagating an element, cross-site validate if we’re changing the status to enabled #16533

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Fixed a bug where changes to custom fields within Matrix blocks weren’t getting merged into existing drafts for the same owner element. ([#16519](https://github.com/craftcms/cms/issues/16519))
- Fixed a bug where native fields (e.g. Title) were showing changed statuses when viewing revisions, if they had been updated since the time the revision was created.
- Fixed a bug where eager-loading element queries could create an excessive amount of cache invalidation tags.
- Fixed a bug where it was possible to enable elements for new sites with validation errors. ([#16505](https://github.com/craftcms/cms/issues/16505))

## 4.14.1 - 2025-01-22

Expand Down
10 changes: 8 additions & 2 deletions src/services/Elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -3282,8 +3282,14 @@ private function _saveElementInternal(

// Validate
if ($runValidation) {
// If we're propagating, only validate changed custom fields
if ($element->propagating) {
// If we're propagating, only validate changed custom fields,
// unless we're enabling this element
if ($element->propagating && !(
$element->getIsDerivative() &&
$element->getIsDraft() &&
$element->getEnabledForSite() &&
!$element->getCanonical()->getEnabledForSite())
) {
$names = array_map(
fn(string $handle) => "field:$handle",
array_unique(array_merge($dirtyFields, $element->getModifiedFields()))
Expand Down