Merge "Output a nice message when the diff is empty"

This commit is contained in:
jenkins-bot 2013-05-10 23:21:09 +00:00 committed by Gerrit Code Review
commit d96a17156a
2 changed files with 14 additions and 8 deletions

View file

@ -164,14 +164,18 @@ class ApiVisualEditor extends ApiBase {
}
$diffRows = $result['query']['pages'][$title->getArticleID()]['revisions'][0]['diff']['*'];
$context = new DerivativeContext( $this->getContext() );
$context->setTitle( $title );
$engine = new DifferenceEngine( $context );
return $engine->addHeader(
$diffRows,
wfMessage( 'currentrev' )->parse(),
wfMessage( 'yourtext' )->parse()
);
if ( $diffRows !== '' ) {
$context = new DerivativeContext( $this->getContext() );
$context->setTitle( $title );
$engine = new DifferenceEngine( $context );
return $engine->addHeader(
$diffRows,
wfMessage( 'currentrev' )->parse(),
wfMessage( 'yourtext' )->parse()
);
} else {
return wfMessage( 'visualeditor-diff-nochanges' )->parse();
}
}
public function execute() {

View file

@ -84,6 +84,7 @@ $messages['en'] = array(
'visualeditor-report-notice' => 'I understand that by clicking "Report problem" I will transmit my changes and my feedback, which will be stored for analysis. I agree to provide feedback in accordance with the [[{{MediaWiki:Visualeditor-report-link}}|Terms of Use]].',
'visualeditor-report-link' => 'foundation:Terms of Use',
'visualeditor-feedback-link' => 'Project:VisualEditor/Feedback',
'visualeditor-diff-nochanges' => 'Your edit will be ignored because you have made no changes to the text.',
);
/** Message documentation (Message documentation)
@ -214,6 +215,7 @@ Do not translate. Only add a language code when a translations of above page exi
Possible entry for German: "foundation:Terms of Use/de"',
'visualeditor-feedback-link' => 'Link to a page where users can leave feedback that is automatically posted using this tool. This should be a sub-page of {{msg-mw|visualeditor-descriptionpagelink}}',
'visualeditor-diff-nochanges' => 'Message displayed in the diff view when no changes were detected',
);
/** Arabic (العربية)