Sort revisions first by timestamp, then revision ID

Created on 22 April 2022, over 2 years ago
Updated 22 March 2023, over 1 year ago

Problem/Motivation

While migrating a large (active) site with important revision history from D7 to D9, the revision IDs would be out of order as they came in, leading to a broken interface from a user perspective. Considering that the revision ID isn't really the important part from an admin user perspective (and isn't displayed in the admin interface anywhere), changing the sort to timestamp (which is the text to the revision link already) seems reasonable.

Steps to reproduce

(Simplest)
1. View a node with multiple revisions.
2. Change one of the revisions in the `node_revision` table - either swap the IDs or swap the timestamps. (Also easier to see the difference if the timestamps are >1 minute apart).
3. Note that the ordering on the `Revisions` (version-history) tab of the node is out-of-order by date.

Proposed resolution

Add an initial sort on getRevisionMetadataKey('revision_created') and use getKey('revision') as the secondary sort.

Remaining tasks

  • Add new test coverage?
  • Reviews / refinements
  • RTBC
  • Commit

User interface changes

The revisions tab will be sorted by timestamp instead of revision ID.

API changes

N/A

Data model changes

N/A

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

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