We are currently using Drupal 8 in Acquia Platform. We are seeing issue of the Node getting locked in few scenarios, Please find them below:

#1 :
- Create an Article of Version 1 and do not publish it
- Update the same article to create Version 2 and do not publish this as well
- Again Update the same to create Version 3 and publish it. It will be successful
- Now try going back to version 2 and publish, You will get an error message "The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved."

#2 :
- Follow the same steps as above to create 3 revisions, but not publish the third one but save
- View the article and click the back button to go to the edit page
- Try to publish the version and you will see the same error message "The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved."

Comments

mtmvivek created an issue. See original summary.

jacov’s picture

+1
I can confirm that this is a reproduceable issue that needs to be fixed.

It is impacting basic Revisions functionality now in core.

@Vivek, can you please also include screenshots here?

jacov’s picture

Priority: Normal » Critical
jacov’s picture

Priority: Critical » Minor

Possible custom code failure, lowering priority

mtmvivek’s picture

Status: Active » Closed (fixed)

Yes Jacob is right, This issue is with the code in the Custom Drupal Theme, Hence closing.

mtmvivek’s picture

Priority: Minor » Critical
Status: Closed (fixed) » Active

When tested with the fix on the Custom Theme code, The issue is not fixed, So re-opening the issue.

pradeep22saini’s picture

StatusFileSize
new917 bytes

Steps used to produce this issue:
1. Create a content with revisions (Moderation) enabled.
2. Create more revisions by editing and saving fields.
3. Now choose any previous revision to revert and save.
4. Now edit the node and save again.
Now there will be message:
"The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved."
Solution
I found out that validation inside this in getting failed on reverting.
core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityChangedConstraintValidator.php

So, I have update the Node time changed while reverting inside this file.
core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityChangedConstraintValidator.php

Any suggestion and other ways are welcome. thanks.

pradeep22saini’s picture

Status: Active » Needs review
pradeep22saini’s picture

StatusFileSize
new1.14 KB

Patch updated.

pradeep22saini’s picture

Project: Drupal 8 Dev » Drupal core
Version: » 8.2.x-dev
Component: Code » node system
Priority: Critical » Major
Status: Needs review » Needs work

I am moving this issue to drupal Core as this is exists there and needs to be resolved.
While using Node revert using workbench modulations it is generated the isssue as explained.

pradeep22saini’s picture

StatusFileSize
new903 bytes

Timestamp updates when revision is saved again.

Any suggestions and ways to do are welcome. thanks

pradeep22saini’s picture

Status: Needs work » Needs review
naveenvalecha’s picture

Status: Needs review » Needs work
+++ b/core/modules/node/src/Form/NodeRevisionRevertForm.php
@@ -111,8 +111,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
+    $this->revision->set('changed', REQUEST_TIME);

Use the datetime.time service getRequestTime() method.

+++ b/core/modules/node/src/Form/NodeRevisionRevertForm.php
@@ -111,8 +111,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
-

Undo this change.

gaurav.kapoor’s picture

Status: Needs work » Needs review
StatusFileSize
new789 bytes

Status: Needs review » Needs work

The last submitted patch, 14: 2744851-14.patch, failed testing.

saurabh rawat’s picture

StatusFileSize
new921 bytes

Please check this patch it is working fine for me

saurabh rawat’s picture

Status: Needs work » Needs review
gaurav.kapoor’s picture

$this->revision = $this->prepareRevertedRevision($this->revision, $form_state);
+	$this->revision->changed = \Drupal::time()->getRequestTime();
     $this->revision->revision_log = t('Copy of the revision from %date.', ['%date' => $this->dateFormatter->format($original_revision_timestamp)]);
     $this->revision->save();

Indentation wrong

saurabh rawat’s picture

StatusFileSize
new924 bytes
saurabh rawat’s picture

I have changed in next patch

The last submitted patch, 16: 2744851-16.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 19: 2744851-18.patch, failed testing.

naveenvalecha’s picture

Status: Needs work » Closed (duplicate)

Closing this as duplicate of #2848508: Reverting a revision causes validation error on edit form submit
Feel free to re-open it