Clean up ApiEditPage content handler undo logic
authorDannyS712 <DannyS712.enwiki@gmail.com>
Mon, 19 Aug 2019 02:13:32 +0000 (02:13 +0000)
committerDannyS712 <DannyS712.enwiki@gmail.com>
Mon, 19 Aug 2019 07:53:21 +0000 (07:53 +0000)
Bug: T230702
Change-Id: I79d528866c54f40c5adcffde8410b9e2d5336ea7

includes/api/ApiEditPage.php

index 3f63a00..554df61 100644 (file)
@@ -92,9 +92,8 @@ class ApiEditPage extends ApiBase {
                $name = $titleObj->getPrefixedDBkey();
                $model = $contentHandler->getModelID();
 
-               if ( $params['undo'] > 0 ) {
-                       // allow undo via api
-               } elseif ( $contentHandler->supportsDirectApiEditing() === false ) {
+               // always allow undo via api, T230702
+               if ( !( $params['undo'] > 0 ) && $contentHandler->supportsDirectApiEditing() === false ) {
                        $this->dieWithError( [ 'apierror-no-direct-editing', $model, $name ] );
                }