From: Timo Tijhof Date: Wed, 7 Sep 2016 20:52:42 +0000 (-0700) Subject: RollbackAction: Allow 'from' to be an empty string X-Git-Tag: 1.31.0-rc.0~5716^2 X-Git-Url: http://git.cyclocoop.org//%27http:/code.google.com/p/ie7-js//%27?a=commitdiff_plain;h=f188c23ca8a105e4bae7cd2b874eb11d9c49b733;p=lhc%2Fweb%2Fwiklou.git RollbackAction: Allow 'from' to be an empty string Fix regression from 9af38c046c86, which made 'from' a required non-empty parameter where previously an empty value was allowed. The rollback links always include a 'from' parameter, but it is set to an empty string by Revision::getUserText if the current revision has its username hidden. Test plan: * Go to action=history, tick latest revision and "Change visibility". * Tick "Editor's username" and apply the change. * Hit "rollback" on the history page. * Before: "missing parameter" error. After: Success. Bug: T141985 Change-Id: I20d23e2aeec858f82231910c030c14ffa3af656f --- diff --git a/includes/actions/RollbackAction.php b/includes/actions/RollbackAction.php index 3dc611b1ae..aa2858d8e3 100644 --- a/includes/actions/RollbackAction.php +++ b/includes/actions/RollbackAction.php @@ -54,7 +54,7 @@ class RollbackAction extends FormlessAction { $user = $this->getUser(); $from = $request->getVal( 'from' ); $rev = $this->page->getRevision(); - if ( $from === null || $from === '' ) { + if ( $from === null ) { throw new ErrorPageError( 'rollbackfailed', 'rollback-missingparam' ); } if ( !$rev ) { diff --git a/resources/src/mediawiki/page/rollback.js b/resources/src/mediawiki/page/rollback.js index d973d07d98..1ff62ba072 100644 --- a/resources/src/mediawiki/page/rollback.js +++ b/resources/src/mediawiki/page/rollback.js @@ -15,7 +15,7 @@ page = mw.util.getParamValue( 'title', url ), user = mw.util.getParamValue( 'from', url ); - if ( !page || !user ) { + if ( !page || user === null ) { // Let native browsing handle the link return true; }