Skip to content

Commit

Permalink
Don’t update single entry’s title when publishing a draft/reverting t…
Browse files Browse the repository at this point in the history
…o a version

Resolves #4323
  • Loading branch information
brandonkelly committed May 28, 2019
1 parent 509ad31 commit f2d85be
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Fixed a bug where pressing the <kbd>Esc</kbd> key in the setup wizard would close the modal window. ([#4307](https://github.com/craftcms/cms/issues/4307))
- Fixed a bug where `craft\validators\ArrayValidator::validate()` didn’t work. ([#4309](https://github.com/craftcms/cms/pull/4309))
- Fixed an error that could occur when rendering templates with a `loop.parent.loop` reference in a nested for-loop. ([#4271](https://github.com/craftcms/cms/issues/4271))
- Fixed a bug where publishing a Single entry’s draft, or reverting a Single entry to a prior version, would overwrite its title to the section name. ([#4323](https://github.com/craftcms/cms/pull/4323))

## 3.1.28 - 2019-05-21

Expand Down
10 changes: 0 additions & 10 deletions src/services/EntryRevisions.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,6 @@ public function saveDraft(EntryDraft $draft, bool $runValidation = true): bool
*/
public function publishDraft(EntryDraft $draft, bool $runValidation = true): bool
{
// If this is a single, we'll have to set the title manually
if ($draft->getSection()->type == Section::TYPE_SINGLE) {
$draft->title = $draft->getSection()->name;
}

// Set the version notes
if (!$draft->revisionNotes) {
$draft->revisionNotes = Craft::t('app', 'Published draft “{name}”.', ['name' => $draft->name]);
Expand Down Expand Up @@ -458,11 +453,6 @@ public function saveVersion(Entry $entry): bool
*/
public function revertEntryToVersion(EntryVersion $version, bool $runValidation = true): bool
{
// If this is a single, we'll have to set the title manually
if ($version->getSection()->type === Section::TYPE_SINGLE) {
$version->title = $version->getSection()->name;
}

// Set the version notes
$version->revisionNotes = Craft::t('app', 'Reverted version {num}.', ['num' => $version->num]);

Expand Down

0 comments on commit f2d85be

Please sign in to comment.