diff --git a/RELEASE-NOTES-1.36 b/RELEASE-NOTES-1.36 index 68a389de623..c2a6cdec5a8 100644 --- a/RELEASE-NOTES-1.36 +++ b/RELEASE-NOTES-1.36 @@ -83,6 +83,11 @@ For notes on 1.35.x and older releases, see HISTORY. * … === Bug fixes in 1.36 === +(T190285) ApiEditPage module used to switch 'undo' and 'undoafter' parameters, +if it founds you reversed them (based on assumption that higher revision ID +indicates a later revision). The assumption is not always true and is hindering +proper edit undoing in some cases, hence the logic has been removed. +Reversing the paramaters will now lead to edit conflict or undefined behavior. * … === Action API changes in 1.36 === diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index b327520d2f4..36b8a091ae7 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -213,10 +213,6 @@ class ApiEditPage extends ApiBase { if ( $params['undo'] > 0 ) { if ( $params['undoafter'] > 0 ) { - if ( $params['undo'] < $params['undoafter'] ) { - list( $params['undo'], $params['undoafter'] ) = - [ $params['undoafter'], $params['undo'] ]; - } $undoafterRev = $revisionLookup->getRevisionById( $params['undoafter'] ); } $undoRev = $revisionLookup->getRevisionById( $params['undo'] ); diff --git a/tests/phpunit/includes/api/ApiEditPageTest.php b/tests/phpunit/includes/api/ApiEditPageTest.php index 72f740e73aa..fd149f2a187 100644 --- a/tests/phpunit/includes/api/ApiEditPageTest.php +++ b/tests/phpunit/includes/api/ApiEditPageTest.php @@ -782,11 +782,7 @@ class ApiEditPageTest extends ApiTestCase { $text = ( new WikiPage( $titleObj ) )->getContent()->getText(); - // This is wrong! It should be 1. But let's test for our incorrect - // behavior for now, so if someone fixes it they'll fix the test as - // well to expect 1. If we disabled the test, it might stay disabled - // even once the bug is fixed, which would be a shame. - $this->assertSame( '2', $text ); + $this->assertSame( '1', $text ); } public function testUndoWithConflicts() { @@ -814,10 +810,6 @@ class ApiEditPageTest extends ApiTestCase { $this->assertSame( '3', $text ); } - /** - * undoafter is supposed to be less than undo. If not, we reverse their - * meaning, so that the two are effectively interchangeable. - */ public function testReversedUndoAfter() { $name = 'Help:' . ucfirst( __FUNCTION__ ); @@ -834,7 +826,7 @@ class ApiEditPageTest extends ApiTestCase { $text = ( new WikiPage( Title::newFromText( $name ) ) )->getContent() ->getText(); - $this->assertSame( '1', $text ); + $this->assertSame( '2', $text ); } public function testUndoToRevFromDifferentPage() {