Page MenuHomePhabricator

Cannot access wikitext of some old revisions on Commons, only get a comparison
Closed, ResolvedPublic

Description

Steps to reproduce:

  • Make a change to structured data on a file description page.
  • In the page history, select an older revision and view it.
  • Click "edit" on the view of the old revision.

Expected result:

  • The edit interface shows, allowing the old wikitext to be viewed, copied, and edited/restored.

Actual result:

  • The user is redirected to action=mcrrestore
  • A diff view is presented which represents the restoration of the old revision.
  • The old revision can be restored, including the old structured data, using the "publish" button.
  • The old wikitext is inaccessible.

Explanation:
When editing based on an old revision, it's conceptually unclear whether that edit should undo any changed since performed on structured data. If no, it's unclear how the old structured data should be restored. To fix this, a specialized interface (McrRestoreAction) was introduced that offers to restore the old revision, including wikitext and structured data, after the user confirmed the change be looking at the corresponding diff view.

Proposal:

  • Do not redirect from the edit interface to action=mcrrestore immediately
  • Present a read-only view of the wikitext (like we do for protected pages).
  • Offer a link to the McrRestoreAction separately.

Original report

I want to restore part of an old version on Commons. Usually on wikipedia I can just go to the plain text of past versions. Example https://en.wikipedia.org/w/index.php?title=Andrew_Goatly&oldid=744109408

However when I go to a past version on Commons and I click edit, I do not get the past version. I get a comparison of edits, with the text restore. Example https://commons.wikimedia.org/w/index.php?title=File:Megacriodes_saundersii.png&action=mcrrestore&restore=152390387

How can I get the old text? So some past changes were bad. But alot of good has been done afterwards. How can I partially restore the good edits?

If this is a bug, please fix it, because it removes a vital part of editing, namely the actual text.

Event Timeline

Aklapper renamed this task from How can I restore old text to Cannot restore an old version on Commons, only get a comparison.Jun 17 2019, 11:41 AM

@Taketa this happens when you try to restore a version with different structured data. (depicts or captions) If no structured data was altered, you get the plain text.

@AlexisJazz Thank you for your response. So if I understand correctly Commons made a switch and all pages with old structured data that are mixed with new structured data do not show properly. However it works fine in both the old structured data and the new structured data. Is that correct? So what I would like to be sure of is that the new structured data also shows ful texts, this has not been removed. All the best.

@AlexisJazz Thank you for your response. So if I understand correctly Commons made a switch and all pages with old structured data that are mixed with new structured data do not show properly. However it works fine in both the old structured data and the new structured data. Is that correct? So what I would like to be sure of is that the new structured data also shows ful texts, this has not been removed. All the best.

@Taketa changes to wikitext will be shown as well, and the wikitext can be accessed for restoring old revisions.

You can read the announcement for this change in the SDC talk page archives, it should help explain why this change happened and how this change works.

Keegan triaged this task as Medium priority.Jul 1 2019, 6:57 PM

You can in fact restore the old version by clicking the big blue "publish changes" button at the bottom. "Publish changes" is the standard messgae for saving an edit, it's a bit confusing here.

What is indeed not possible is to view the entire old text. This cannot be done the "normal" way if there is structured data attached to the page, since you would oly get the old text, not the old data, and things would get confusing.

It would not be terrible hard to at least show the old text (and data). For this, we would just have to present a diff between an empty page and the old revision, instead of the diff between the old revision and the current revision. I think it could be a multi stage process: first, show the "from empty" diff that shows all content. Then, if desired, show the diff that represents the revert. Then, the user can approve the revert.

I wanted to copy some text from the old edit and add it to the current page.

Why not simply make multiedits impossible? If someone wants to change both the file page and structured data they can make 2 edits. There is no reason to allow something that will fuck up the system :-)

As a Commons administrator, I often have to deal with vandalism to file pages with structured data, especially page blanking. Often, there will be conflicting intermediate edits that make a simple undo, rollback, or restore unusable. In these cases, I would normally view the wikitext of an un-vandalized revision, copy the relevant section, and fix the page. However, the diff view of the "Restore a revision" interface makes this task much more difficult. While I can copy the hunks, I must either copy them individually or spend time removing the extra characters introduced by the diff view. This makes the task of reverting vandalism much more time consuming.

Multichill raised the priority of this task from Medium to High.Oct 10 2020, 11:09 PM
Multichill added a subscriber: Ramsey-WMF.

Raising this to high because more than half the files on Commons have structured data now so the chance of running into this is much higher.
The easiest solution is probably to just show the wikitext in view mode only like when you try to edit a protected page, but you don't have the right to do so. That way we can at least access the wikitext and copy it.

Tagging PET to have another look at this. It's something that came out of the initial MCR implementation, and was meant as a placeholder for a more complete solution. Perhaps someone from PET (me, I guess) could work on this with someone from the structured data team to get this done.

I'm not sure how to fit this into PETs processes and priorities, but it (see T225897#6315977) seems small enough that we should just go and do it, rather than burning energy on discussion.

It seems that structured data breaks old revisions. Not just for random files but for ALL files. So soon we have 60 million files on Commons where the old revisions are broken.

It seems that structured data breaks old revisions. Not just for random files but for ALL files. So soon we have 60 million files on Commons where the old revisions are broken.

The old revisions are not broken. It's just the interface that is very awkward making it hard to access these revisions. Take for example https://commons.wikimedia.org/w/index.php?title=File:Megacriodes_saundersii.png&action=history , you can see the content of all revisions at https://commons.wikimedia.org/w/api.php?action=query&prop=revisions&titles=File:Megacriodes_saundersii.png&rvlimit=50&rvprop=timestamp|user|comment|content&format=json .

CBogen added subscribers: Naike, CBogen.

@Naike and @daniel, is this something PET can get to anytime soon? Thanks!

My updated understanding of what's going on here:

Before the introduction of structured data, a user could click to edit an old revision, and if they saved that (possibly edited) old revision then that would become the new latest revision.

With structured data this no longer makes sense, because structured data is not added/edited on the edit page, but on the "read" version of the page. Say the current revision of a page is n, and structured data was added in revision n - 1. If I click on revision n - 2 and then click edit and save, what should happen - should the structured data added in n - 1 be removed? It's not clear that it should.

To work around this, the PET added an 'mcrrestore' page that shows a diff, and has a 'publish' button that allows the user to restore the old revision. If a user is looking at an old revision, and there are structured data differences between the latest revision and that revision, then clicking 'edit' redirects them to the 'mcrrestore' page

What we propose to do to improve this is, if a user clicks to view an old revision where there have been structured data edits between now and the revision then:

  • instead of the 'edit' tab on the old revision page, there will be a 'view source' tab that will show the wikitext at the time of the revision (similar to how protected pages work atm)
  • there will be a link to 'mcrrestore' above the read-only text (or perhaps as a tab in the "head" of the page if it's not hard to figure out how to do)
daniel renamed this task from Cannot restore an old version on Commons, only get a comparison to Cannot access wikitext of some old revisions on Commons, only get a comparison.Nov 4 2020, 4:13 PM
daniel updated the task description. (Show Details)

I have updated the task description to more accurately reflect the problem and its causes.

Change 642481 had a related patch set uploaded (by Cparle; owner: Cparle):
[mediawiki/core@master] Show read-only wikitext if editing old revision with non-main-slot diffs from latest

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

Change 642481 merged by jenkins-bot:
[mediawiki/core@master] Show read-only wikitext if editing old revision with non-main-slot diffs from latest

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

Etonkovidova subscribed.

Checked in production (commons wmf.20) and in betalabs commons (tested more in depth there).

Works as described in this comment:

The easiest solution is probably to just show the wikitext in view mode only like when you try to edit a protected page, but you don't have the right to do so. That way we can at least access the wikitext and copy it.

Structured edits can be edited in wikitext only if they are the most recent.
For example, the following edits were made in this order (1 - the oldest, 4 - is the most recent)
(1) added claim
(2) changed description
(3) added caption
(4) some edit to Structured data

After each of the above edit, there was an attempt to edit the version with the added claim.

Last editCan the version with "added claim" be edited?
added claimYes
changed descriptionYes
added captionNo
some edits to Structured dataNo

Checked in production (commons wmf.20) and in betalabs commons (tested more in depth there).

Production got rolled back to 1.36.0-wmf.18 (rMW040d7a43ca57) so broken again.