Problem/Motivation
1. Create a node, e.g. Article, with some sample content.
2. Wait a minute or so.
3. View node on public site (front page or /node/x), use quick-edit to alter one of the fields (e.g. title or description), then click Save.
4. View /node/x/revisions.
Expected behaviour:
1. on /node/x/revisions, time of current revision will be different from previous revisions (i.e. at least a minute later.)
2. because in DB, node_revision.revision_timestamp of latest revision should be different.
Actual behaviour:
revision_timestamp identical to previous revision
Proposed resolution
Write revision_timestamp property using current time.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
wturrell commentedWorking on a patch for this.
Comment #3
wturrell commentedComment #4
wturrell commentedComment #5
wturrell commentedUse the issue template and update the issue title for a better commit message (resolution rather than problem.)
Comment #6
wturrell commentedNote: This bug is present in 8.3.x too (I'm not entirely clear how to tag an issue when that's the case, or which is the correct branch to work on. Feel free to point me towards suitable docs.)
Comment #7
wim leersThanks for all your help! Much appreciated :)
See
i.e. that's all the revision handling we have today. We simply respect the entity type's "autocreate revisions or not" setting.
But I understand that the problem is that the revision timestamp is not being updated accordingly. I'd expect the Entity API to handle this for us. Where is
revision_timestampbeing set for regular node edits? (I couldn't find it in a quick search.)Comment #8
wim leersClarifying issue title further.
Comment #9
tstoecklerI think we all would. Unfortunately none of us live in that beatiful world you depict.
See
\Drupal\node\NodeForm::submitForm(). There thesetNewRevision()flag is being set and the revision author and timestamp, as well. (The revision log field comes from the form values.)Comment #10
wim leersThanks, @tstoeckler! That's helpful.
In other words, we want Node-specific logic to be removed from
NodeForm. For that, we need #1863258: Move entity preparation from form controller to entity class: "last changed" timestamp not updated and "create new revision" setting not respected when updating entities via Entity API + #2248983: Define the revision metadata base fields in the entity annotation in order for the storage to create them only in the revision table. Is that accurate?Comment #11
tstoecklerI wasn't aware #1863258: Move entity preparation from form controller to entity class: "last changed" timestamp not updated and "create new revision" setting not respected when updating entities via Entity API existed, and that seems like super, super non-trivial to get done at this point, but yes, I think that is correct.
Comment #12
wim leersComment #15
wim leersWe can now actually do this! See #2925846-3: Quick Edit only creates revision for Node entities, should do it for all content entity types that support it.
We're still adding logic to Quick Edit that should not exist. We still have #1863258: Move entity preparation from form controller to entity class: "last changed" timestamp not updated and "create new revision" setting not respected when updating entities via Entity API to fix that. But in the mean time, we can at least make it work generically for all (content) entity types. That's what #2925846: Quick Edit only creates revision for Node entities, should do it for all content entity types that support it is about.