Page MenuHomePhabricator

[Regression] FlaggedRevs: When undoing unrevieved edit, user is asked whether to review the resulting revision
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Ensure you have (review) right on wiki
  • Find a page with unreviewed change
  • Go to history of a page and click "Undo" next to the unreviewed revision

What happens?:
A standard Undo interface appears, but next to the "Watch", "Minor edit" controls there's also a checkbox "Accept this version (includes 1 pending change)".

What should have happened instead?:
The checkbox "Accept this version" has no sense there as the undoafter version has already been reviewed. According to the report on plwiki, the checkbox didn't use to appear.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia): plwiki

Other information (browser name/version, screenshots, etc.):

image.png (242×1 px, 40 KB)

We waited for a patch for T361940 hoping that it'll solve the issue, but apparently it didn't.

Event Timeline

if ( !$editPage->getArticle()->getOldID() ) { in 3ac6aa22cf8c4ef69272a15f5356ad5264d0e30c

getOldID needs oldidparameter, revert links don't have it.

@Wargo To clarify, you mean that getOldID() only checks whether we're viewing a page with the &oldid=… URL parameter, and we should also check for the &undoafter=…&undo=… parameters? That would make sense to me. (There's also a comment in that code that says "check not shown when editing old revisions, which [would be] confusing", and preparing a revert of the latest revision is a lot like editing the previous revision.)

The commit 3ac6aa22cf8c4ef69272a15f5356ad5264d0e30c seems to have made a few other unintentional changes to the behavior… I have tried out a few things, and noticed that when editing an older reviewed revision, the new revision is no longer autoreviewed. I'm not really sure how it's supposed to behave, though.

(There's also a comment in that code that says "check not shown when editing old revisions, which [would be] confusing", and preparing a revert of the latest revision is a lot like editing the previous revision.)

I don’t think it’s “a lot like editing the previous revision”: the edited revision is not really old, it’s probably quite recent, and the revert is more like opening the latest revision and doing the opposite of what the reverted user did. (Even if the reverted edit is older, it’s still like doing the opposite of what the other did: edits done in later edits are not undone, unlike when one starts editing an old revision.)

There are three cases:

  • Reverting to a reviewed version. In this case, the checkbox didn’t use to appear, and the revert used to be unconditionally reviewed. Now the checkbox appears, but if I recall correctly (I did one such revert since 3ac6aa22cf8c was deployed), the revert still gets reviewed even if one doesn’t tick the checkbox. (Which is very counter-intuitive.)
  • Reverting to a pending version. In this case, the checkbox used to, and should continue to, appear, as one has a real choice: if all pending edits except for the one being reverted are good, then the revert can be reviewed, if there are other issues as well, it shouldn’t be.
  • Reverting to a version that’s not reviewed but there are newer, reviewed versions. I don’t know how this case used to work, how it works now, or how it should work.

@Wargo To clarify, you mean that getOldID() only checks whether we're viewing a page with the &oldid=… URL parameter, and we should also check for the &undoafter=…&undo=… parameters?

Yes, this is definitionof this function (method). Undo URL doesn't provide oldid.

Change #1020946 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/FlaggedRevs@master] Restore autoreview behavior when undoing or editing old revisions

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

I'll be honest, I'm not sure how it's supposed to work. But I think I managed to restore how it worked.

I set up demo wikis to compare:
Before the bug: https://patchdemo.wmflabs.org/wikis/777f1587e8/w/index.php?title=Test1&action=edit&undoafter=152&undo=153
Current buggy version: https://patchdemo.wmflabs.org/wikis/1010d4fce1/w/index.php?title=Test1&action=edit&undoafter=152&undo=153
After the fix: https://patchdemo.wmflabs.org/wikis/83a92cb3f0/w/index.php?title=Test1&action=edit&undoafter=152&undo=153

If someone here feels like they understand it, I'd appreciate if you could test on those demo wikis as well.

I'll be honest, I'm not sure how it's supposed to work. But I think I managed to restore how it worked.

I set up demo wikis to compare:
Before the bug: https://patchdemo.wmflabs.org/wikis/777f1587e8/w/index.php?title=Test1&action=edit&undoafter=152&undo=153
Current buggy version: https://patchdemo.wmflabs.org/wikis/1010d4fce1/w/index.php?title=Test1&action=edit&undoafter=152&undo=153
After the fix: https://patchdemo.wmflabs.org/wikis/83a92cb3f0/w/index.php?title=Test1&action=edit&undoafter=152&undo=153

If someone here feels like they understand it, I'd appreciate if you could test on those demo wikis as well.

@matmarex How can we test this? Do we have to get rights on these patchdemo wikis? (AFAIK, the accept checkbox does not appear if one does not have editor rights).

I'll be honest, I'm not sure how it's supposed to work. But I think I managed to restore how it worked.

I set up demo wikis to compare:
Before the bug: https://patchdemo.wmflabs.org/wikis/777f1587e8/w/index.php?title=Test1&action=edit&undoafter=152&undo=153
Current buggy version: https://patchdemo.wmflabs.org/wikis/1010d4fce1/w/index.php?title=Test1&action=edit&undoafter=152&undo=153
After the fix: https://patchdemo.wmflabs.org/wikis/83a92cb3f0/w/index.php?title=Test1&action=edit&undoafter=152&undo=153

If someone here feels like they understand it, I'd appreciate if you could test on those demo wikis as well.

@matmarex How can we test this? Do we have to get rights on these patchdemo wikis? (AFAIK, the accept checkbox does not appear if one does not have editor rights).

Login: Patch Demo
P4ssw0rd: patchdemo1

I'll be honest, I'm not sure how it's supposed to work. But I think I managed to restore how it worked.

I set up demo wikis to compare:
Before the bug: https://patchdemo.wmflabs.org/wikis/777f1587e8/w/index.php?title=Test1&action=edit&undoafter=152&undo=153
Current buggy version: https://patchdemo.wmflabs.org/wikis/1010d4fce1/w/index.php?title=Test1&action=edit&undoafter=152&undo=153
After the fix: https://patchdemo.wmflabs.org/wikis/83a92cb3f0/w/index.php?title=Test1&action=edit&undoafter=152&undo=153

If someone here feels like they understand it, I'd appreciate if you could test on those demo wikis as well.

@matmarex How can we test this? Do we have to get rights on these patchdemo wikis? (AFAIK, the accept checkbox does not appear if one does not have editor rights).

Login: Patch Demo
P4ssw0rd: patchdemo1

Thanks! Versions "Before the bug" and "After the fix" look the same, so it seems that the matmarex's fix works correctly.

I created two additional test pages:

Thanks @matmarex!

Change #1020946 merged by jenkins-bot:

[mediawiki/extensions/FlaggedRevs@master] Restore autoreview behavior when undoing or editing old revisions

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

matmarex removed a project: Patch-For-Review.

The change will be deployed to Wikimedia wikis next week, on the usual schedule (Tuesday-Thursday).

  NODES
Note 3
Project 3