From f188c23ca8a105e4bae7cd2b874eb11d9c49b733 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 7 Sep 2016 13:52:42 -0700 Subject: [PATCH] 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 --- includes/actions/RollbackAction.php | 2 +- resources/src/mediawiki/page/rollback.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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; } -- 2.20.1