Foxtrott has submitted this change and it was merged. Change subject: autoedit: wiki-format response messages ......................................................................
autoedit: wiki-format response messages Autoedit response texts were returned as is, are now properly parsed Minor fix: Parameters 'query' and 'preload' correctly registered. Change-Id: I42cfd3da1700f2961bbbe24ca435398cd0aba416 --- M includes/SF_AutoeditAPI.php 1 file changed, 20 insertions(+), 20 deletions(-) Approvals: Foxtrott: Verified; Looks good to me, approved diff --git a/includes/SF_AutoeditAPI.php b/includes/SF_AutoeditAPI.php index 6c1d26b..007fe26 100644 --- a/includes/SF_AutoeditAPI.php +++ b/includes/SF_AutoeditAPI.php @@ -544,7 +544,7 @@ // set response text depending on the status and the requested action if ( $this->mStatus === 200 ) { if ( array_key_exists( 'ok text', $this->mOptions ) ) { - $responseText = $this->mOptions[ 'ok text' ]; + $responseText = MessageCache::singleton()->parse( $this->mOptions[ 'ok text' ], Title::newFromText( $this->mOptions[ 'target' ] ) )->getText(); } elseif ( $this->mAction === self::ACTION_SAVE ) { $responseText = wfMessage( 'sf_autoedit_success', $this->mOptions[ 'target' ], $this->mOptions[ 'form' ] )->parse(); } else { @@ -553,25 +553,23 @@ } else { // get errortext (or use default) if ( array_key_exists( 'error text', $this->mOptions ) ) { - $responseText = $this->mOptions[ 'error text' ]; + $responseText = MessageCache::singleton()->parse( $this->mOptions[ 'error text' ], Title::newFromText( $this->mOptions[ 'target' ] ) )->getText(); } elseif ( $this->mAction === self::ACTION_SAVE ) { $responseText = wfMessage( 'sf_autoedit_fail', $this->mOptions[ 'target' ] )->parse(); } else { $responseText = null; } } - - $result = $this->getResult(); - - if ( $responseText !== null ) { - $this->getResult()->addValue( null, 'responseText', $responseText ); - } - - $this->getResult()->addValue( null, 'status', $this->mStatus, true ); - - $this->getResult()->addValue( array('form'), 'title', $this->mOptions[ 'form' ] ); - $this->getResult()->addValue( null, 'target', $this->mOptions[ 'target' ], true ); + $result = $this->getResult(); + + if ( $responseText !== null ) { + $result->addValue( null, 'responseText', $responseText ); + } + + $result->addValue( null, 'status', $this->mStatus, true ); + $result->addValue( array('form'), 'title', $this->mOptions[ 'form' ] ); + $result->addValue( null, 'target', $this->mOptions[ 'target' ], true ); } /** @@ -598,9 +596,9 @@ /** * Generates a target name from the given target name formula - * + * * This parses the formula and replaces <unique number> tags - * + * * @global type $wgParser * @param type $targetNameFormula * @return type @@ -668,7 +666,7 @@ // set target title $target_title = Title::newFromText( preg_replace( '/{num.*}/', $title_number, $targetName ) ); - + // if title exists already cycle through numbers for this tag until // we find one that gives a nonexistent page title while ( $target_title->exists() ) { @@ -807,7 +805,7 @@ // and merge/overwrite it with the new data $this->mOptions = SFUtils::array_merge_recursive_distinct( $data, $this->mOptions ); - + } else { if ( isset( $this->mOptions[ 'preload' ] ) ) { $this->logMessage( wfMessage( 'sf_autoedit_invalidpreloadspecified', $this->mOptions[ 'preload' ] )->parse(), self::WARNING ); @@ -852,7 +850,7 @@ $this->mOptions[ 'formHTML' ] = $formHTML; $this->mOptions[ 'formJS' ] = $formJS; - + if ( $isFormSubmitted ) { // if the target page was not specified, see if something was generated @@ -1073,7 +1071,8 @@ return array( 'form' => null, 'target' => null, - 'query' => null + 'query' => null, + 'preload' => null ); } @@ -1087,7 +1086,8 @@ return array( 'form' => 'The form to use.', 'target' => 'The target page.', - 'query' => 'The query string.' + 'query' => 'The query string.', + 'preload' => 'The name of a page to preload' ); } -- To view, visit https://gerrit.wikimedia.org/r/57840 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I42cfd3da1700f2961bbbe24ca435398cd0aba416 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/SemanticForms Gerrit-Branch: master Gerrit-Owner: Foxtrott <s7ep...@gmail.com> Gerrit-Reviewer: Foxtrott <s7ep...@gmail.com> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits