jenkins-bot has submitted this change and it was merged.

Change subject: Output a nice message when the diff is empty
......................................................................


Output a nice message when the diff is empty

Bug: 43754
Change-Id: I8daae124b060ccf54ce5ca7c1e1a6d18b7265ade
---
M ApiVisualEditor.php
M VisualEditor.i18n.php
2 files changed, 14 insertions(+), 8 deletions(-)

Approvals:
  Esanders: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index d4eb318..c218f13 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -164,14 +164,18 @@
                }
                $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() {
diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index 38e418d..8373d8f 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -84,6 +84,7 @@
        '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 @@
 
 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 (العربية)

-- 
To view, visit https://gerrit.wikimedia.org/r/63236
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8daae124b060ccf54ce5ca7c1e1a6d18b7265ade
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to