Skip to content

Commit

Permalink
Update unsaved element URIs on autosave
Browse files Browse the repository at this point in the history
Resolves #4581
  • Loading branch information
brandonkelly committed Jan 9, 2020
1 parent fe41684 commit c467fa7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-v3.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@
- The Assets index page now updates the URL when the selected volume changes.
- Sections’ entry URI format settings are now shown when running Craft in headless mode. ([#4934](https://github.com/craftcms/cms/issues/4934))
- The “Primary entry page” preview target is now user-customizable alongside all other preview targets in sections’ settings. ([#4520](https://github.com/craftcms/cms/issues/4520))
- Unsaved entries’ URIs are now updated on each autosave. ([#4581](https://github.com/craftcms/cms/issues/4581))
- Plain Text fields can now specify a maximum size in bytes. ([#5099](https://github.com/craftcms/cms/issues/5099))
- Plain Text fields’ Column Type settings now have an “Automatic” option, which is selected by default for new fields. ([#5099](https://github.com/craftcms/cms/issues/5099))
- Matrix fields now show an accurate description of their propagation behavior in the translation icon tooltip. ([#5304](https://github.com/craftcms/cms/issues/5304))
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- The queue info in the global sidebar no longer shows an HUD with job details when clicked; the user is now brought to the new Queue Manager utility, if they have permission to view it. ([#4040](https://github.com/craftcms/cms/issues/4040))
- Element index pages once again link to elements’ edit pages even if `getIsEditable()` returns `false`.
- “Edit” Asset pages now have a read-only mode for assets that the user is allowed to view but not modify.
- Unsaved entries’ URIs are now updated on each autosave. ([#4581](https://github.com/craftcms/cms/issues/4581))
- Replaced the deprecated zend-feed library with laminas-feed. ([#5400](https://github.com/craftcms/cms/issues/5400))
- Updated yii2-queue to 2.3.

Expand Down
8 changes: 7 additions & 1 deletion src/validators/ElementUriValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ public function validateAttribute($model, $attribute)

// If this is a draft or revision and it already has a URI, leave it alone
/** @var Element $model */
if (($model->getIsDraft() || $model->getIsRevision()) && $model->uri) {
if (
$model->uri &&
(
($model->getIsDraft() && !$model->getIsUnsavedDraft()) ||
$model->getIsRevision()
)
) {
return;
}

Expand Down

0 comments on commit c467fa7

Please sign in to comment.