WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#35171 closed defect (bug) (invalid)

Publish box: the revisions count and the revisions limit numbers mismatch

Reported by: afercia Owned by: adamsilverstein
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Revisions Keywords:
Focuses: ui Cc:

Description (last modified by afercia)

Noticed while investigating on #35029: probably an edge case but when a post has an autosave, the Revisions count number includes the autosave while the revisions limit number refers to revisions - autosave. See in the screenshot below:

https://cldup.com/F9hLP-9YZn.png

I guess this is a bit confusing for users, it's really not clear at first sight why the first number is "4" and the second number is "3". This inconsistency is going to be more evident now that #35029 proposes to show the revisions limit warning in plain text.

As far as I see, wp_get_post_revisions() returns also autosaves because technically they're "revisions". See also wp_is_post_autosave().

The only reference I've found is in the Codex:
https://codex.wordpress.org/Revisions#Revision_Options
(when the revisions limit is set to) (int) > 0: store that many revisions (+1 autosave) per post.

Open to suggestions, maybe the warning should say "the last n revisions and 1 autosave"?

Change History (8)

#1 @afercia
4 years ago

  • Description modified (diff)

#2 @adamsilverstein
4 years ago

One special thing about autosaves: they exist on a per user basis, so if multiple users edit a single post, each user gets an autosave :) Maybe it would be best to exclude autosaves entirely from the count so the number correctly matched the maximum set? Once users navigate to the revisions screen, autosaves are clearly marked.

Related: #34560 where I am attempting to rewrite how this number is calculate to make it more efficient.

Last edited 4 years ago by adamsilverstein (previous) (diff)

#3 follow-up: @afercia
4 years ago

  • Milestone changed from Awaiting Review to 4.5
  • Owner set to adamsilverstein
  • Status changed from new to assigned

Thanks very much @adamsilverstein for your feedback. You're the revisions expert, so I'm going to assign to you ;)

#4 in reply to: ↑ 3 @adamsilverstein
4 years ago

Replying to afercia:

Thanks very much @adamsilverstein for your feedback. You're the revisions expert, so I'm going to assign to you ;)

Haha! Thanks :) Curious what you think of my suggestion of leaving autosaves out of the calculation? So if you had 4 revisions and 1 autosave, the number would only mention the revisions: "Revisions: 4", this would match the text "Your site is configured to keep only the last 4 revisions".

Last edited 4 years ago by adamsilverstein (previous) (diff)

#5 @afercia
4 years ago

From a user's perspective, I think your proposal is what would make more sense. The text in the Publish box says "Revisions" so it should really count just the revisions. On the other hand, once users land in the Revisions screens they may be a little surprised seeing 5 items (4 revisions + 1 autosave in your example). Not a big deal I think, probably just need to be highlighted (in plain text?) on the Revisions screen?

#6 @swissspidy
3 years ago

@afercia Isn't this obsolete now after #35029?

#7 @afercia
3 years ago

@swissspidy I'd say yes :) I'd defer to @adamsilverstein though

#8 @ocean90
3 years ago

  • Milestone 4.5 deleted
  • Resolution set to invalid
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.