Page MenuHomePhabricator

Should we support Edit Recovery for old revisions?
Closed, ResolvedPublic

Description

Problem

It is possible to edit an older revision of a page. Currently, Edit Recovery does not distinguish between different revisions of the same page:

  • If I open the editor for an older revision, if I have Edit Recovery data for a different revision it will be restored.
  • If I edit an older revision, Edit Recovery will overwrite the recovery data it has for a different revision of the same page.
Solutions
  • We could disable Edit Recovery for any revisions other than the latest. However, an editor might legitimately want to edit an older revision (overwriting any intervening edits).
  • Store separate Edit Recovery data for each revisions a user edits. Somewhat similar to how we handle editing sections.
Examples

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptOct 2 2023, 1:33 PM

This could perhaps be handled similarly to the situation of restoring a page when there's been a subsequent revision. In both cases (when we're on an old revision, and the stored data is based on a newer revision; or we're on the latest revision, but the stored data is based on an older revision) we could let the user know.

How should we do this?

A message could be added to the notification toast that is shown on recovery, e.g. "Your unsaved changes have been automatically recovered. These changes were based on a different version of the page; please review your changes before saving."

If I open the editor for an older revision, if I have Edit Recovery data for a different revision it will be restored.
If I edit an older revision, Edit Recovery will overwrite the recovery data it has for a different revision of the same page.

One way to avoid this would be to never use Edit Recovery when editing an old revision. Would that be better?

One way to avoid this would be to never use Edit Recovery when editing an old revision. Would that be better?

I think so. FWIW it's been quite irritating to see the popup when all I wanted to do is open an old revision of a page I'm currently editing and compare and contrast the two revisions. T354392 partially addresses this, but what about when I open an old revision first? I think it should only save edits as long as the base revision was the latest revision when the user started editing it.

When you open an old revision to compare, what changes are you making to it? Because if all you're doing is opening it then it shouldn't save any data and so shouldn't mess anything up. If you are editing it, then we're at the same issue of how to handle multiple different changes to the same page, which is trickier, but I think if we solve it then the solution would probably work for old revisions as well as multiple edits to the same revision.

You don't always just look at an old revision, oftentimes you want to take bits in and out and see how it looks on preview. Right now, if you open an old revision and change even one byte in the textarea, and start editing the live version, you get the modified old version restored and you have to manually discard changes to even see the live version. This is frustrating particularly because it barely even registers you've made changes when you have no intention of ever publishing it and you're just there for the source and preview.

I know this is mostly old habits and future Wikimedians would just learn the new way, but at the same time I doubt anyone would complain if edits to old revisions weren't recovered. Or if they were tied to each revision so editing a different revision wouldn't restore them. (And T350653 provides a quick fix to all of this ๐Ÿ˜†)

Okay, let's disable it when editing old revisions (any time oldid is used).

It will still work if a page is edited sometime after another revision has been saved in the meantime (i.e. it would effectively be editing an old revision at that point, but we don't want to prevent it loaded in that situation).

Change 989384 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/core@master] Edit Recovery: Do not enable when editing old revisions

https://gerrit.wikimedia.org/r/989384

Change 989384 merged by jenkins-bot:

[mediawiki/core@master] Edit Recovery: Do not enable when editing old revisions

https://gerrit.wikimedia.org/r/989384

Edit Recovery does not seem to be loaded on old revisions. The data is not saved in indexeddb and nothing is recovered.

Other functionality also does not happen. If you have existing Edit Recovery data for the page it will not be cleared if you click publish or cancel. I assume expiring data won't happen either, although I didn't test.

If you are viewing the preview or diff of an old revision (i.e. action=submit and the oldid parameter is removed from the URL) and your browser crashes, when you restore the tabs the browser might not restore the correct state. Edit Recovery might then be enabled in a tab which it was not enabled before the crash. I don't know if there is much we can do about this.

At the moment, we don't show any indication to the user about whether Edit Recovery is enabled or not. We may want to add this in the future just to make sure the user knows when their edits are being saved and when they are not.

Test environment: https://en.wikipedia.beta.wmflabs.org MediaWiki 1.42.0-alpha (0a03f2a) 08:00, 17 January 2024.