Order revisions by timestamp to better support Drafty, Workbench Moderation, etc

Created on 26 May 2017, about 8 years ago
Updated 16 December 2024, 7 months ago

Currently, Diff is using node_revision_list() or diff_node_revision_list() which order the revisions by 'vid' and on the Revisions tab, it enforces that the lower 'vid' is always on the left, and the higher 'vid' is always on the right.

Unfortunately, Drafty (used by Workbench Moderation and others) makes a wacky revision spaghetti, where the highest vid always belongs to the published revision. This means that drafts modifying the published version have lower vids, and so comparisons against the published version are always backwards: from a newer draft on the left, to the older published version on the right!

Ordering the revisions by the timestamp (along with some Drafty and Workbench Moderation patches to correct the timestamp!) will bring sanity back to revision comparisons with Diff :-)

Since there isn't normally a way to override the 'timestamp' (node_save() always sets it to the request time) ordering by 'timestamp' should be effectively the same as ordering by 'vid' -- only in the case where two revisions have the exact same 'timestamp' could there be differences (and we can do ORDER BY timestamp DESC, vid DESC to prevent that problem) so this should be safe to do even on sites that aren't using Drafty or Workbench Moderation.

For reference, here's the Drafty and Workbench Moderation issues that will correct the timestamp to reflect the real history:

At least the Drafty one seems to have some momentum, and I suspect it'll get merged eventually. The Workbench Moderation one is new yet.

πŸ“Œ Task
Status

Closed: outdated

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dsnopek USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024