Wctaiwan has uploaded a new change for review. https://gerrit.wikimedia.org/r/142859
Change subject: Improve Special:MassMessage state checking ...................................................................... Improve Special:MassMessage state checking Use getVal() instead of getText() to check for form state; replace == with ===. Change-Id: Ief4a334a1eef1fce382ebdf50011e04e4d7db702 --- M includes/SpecialMassMessage.php 1 file changed, 7 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassMessage refs/changes/59/142859/1 diff --git a/includes/SpecialMassMessage.php b/includes/SpecialMassMessage.php index 8d6fb67..ba11108 100644 --- a/includes/SpecialMassMessage.php +++ b/includes/SpecialMassMessage.php @@ -47,9 +47,9 @@ $this->status = new Status(); // Figure out what state we're in. - if ( $request->getText( 'submit-button' ) == $this->msg( 'massmessage-form-submit' )->text() ) { + if ( $request->getVal( 'submit-button' ) !== null ) { $this->state = 'submit'; - } elseif ( $request->getText( 'preview-button' ) == $this->msg( 'massmessage-form-preview' )->text() ) { + } elseif ( $request->getVal( 'preview-button' ) !== null ) { $this->state = 'preview'; } else { $this->state = 'form'; @@ -58,7 +58,7 @@ $form = new HtmlForm( $this->createForm(), $context ); $form->setId( 'mw-massmessage-form' ); $form->setDisplayFormat( 'div' ); - if ( $this->state == 'form' ) { + if ( $this->state === 'form' ) { $form->addPreText( $this->msg( 'massmessage-form-header' )->parse() ); } $form->setWrapperLegendMsg( 'massmessage' ); @@ -69,13 +69,13 @@ $form->prepareForm(); $result = $form->tryAuthorizedSubmit(); if ( $result === true || ( $result instanceof Status && $result->isGood() ) ) { - if ( $this->state == 'submit' ) { // If it's preview, everything is shown already. + if ( $this->state === 'submit' ) { // If it's preview, everything is shown already. $msg = $this->msg( 'massmessage-submitted' )->params( $this->count )->plain(); $output->addWikiText( $msg ); $output->addWikiMsg( 'massmessage-nextsteps' ); } } else { - if ( $this->state == 'preview' ) { + if ( $this->state === 'preview' ) { $result = $this->status; } $form->displayForm( $result ); @@ -140,7 +140,7 @@ 'default' => $request->getText( 'message' ) ); - if ( $this->state == 'preview' ) { + if ( $this->state === 'preview' ) { // Adds it right before the 'Send' button $m['message']['help'] = EditPage::getCopyrightWarning( $this->getPageTitle( false ), 'parse' ); $m['submit-button'] = array( @@ -183,7 +183,7 @@ return $this->status; } - if ( $this->state == 'submit' ) { + if ( $this->state === 'submit' ) { $this->count = MassMessage::submit( $this->getContext(), $data ); return $this->status; } else { // $this->state can only be 'preview' here -- To view, visit https://gerrit.wikimedia.org/r/142859 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ief4a334a1eef1fce382ebdf50011e04e4d7db702 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MassMessage Gerrit-Branch: contenthandler Gerrit-Owner: Wctaiwan <wctai...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits