TheDJ has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/193578

Change subject: LivePreview: Notifiy user about errors
......................................................................

LivePreview: Notifiy user about errors

Bug: T90490
Change-Id: Ic52311839c175a213065eec442e50b4de0463822
---
M languages/i18n/en.json
M languages/i18n/qqq.json
M resources/Resources.php
M resources/src/mediawiki.action/mediawiki.action.edit.preview.js
4 files changed, 12 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/78/193578/1

diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 31c766f..be2f52c 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -597,6 +597,7 @@
        "missingcommentheader": "<strong>Reminder:</strong> You have not 
provided a subject/headline for this comment.\nIf you click 
\"{{int:savearticle}}\" again, your edit will be saved without one.",
        "summary-preview": "Summary preview:",
        "subject-preview": "Subject/headline preview:",
+       "previewerrortext": "An error occurred while attempting to preview your 
changes.",
        "blockedtitle": "User is blocked",
        "blockedtext": "<strong>Your username or IP address has been 
blocked.</strong>\n\nThe block was made by $1.\nThe reason given is 
<em>$2</em>.\n\n* Start of block: $8\n* Expiry of block: $6\n* Intended 
blockee: $7\n\nYou can contact $1 or another 
[[{{MediaWiki:Grouppage-sysop}}|administrator]] to discuss the block.\nYou 
cannot use the \"email this user\" feature unless a valid email address is 
specified in your [[Special:Preferences|account preferences]] and you have not 
been blocked from using it.\nYour current IP address is $3, and the block ID is 
#$5.\nPlease include all above details in any queries you make.",
        "autoblockedtext": "Your IP address has been automatically blocked 
because it was used by another user, who was blocked by $1.\nThe reason given 
is:\n\n:<em>$2</em>\n\n* Start of block: $8\n* Expiry of block: $6\n* Intended 
blockee: $7\n\nYou may contact $1 or one of the other 
[[{{MediaWiki:Grouppage-sysop}}|administrators]] to discuss the block.\n\nNote 
that you may not use the \"email this user\" feature unless you have a valid 
email address registered in your [[Special:Preferences|user preferences]] and 
you have not been blocked from using it.\n\nYour current IP address is $3, and 
the block ID is #$5.\nPlease include all above details in any queries you 
make.",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 6253fc9..12e6820 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -761,6 +761,7 @@
        "missingcommentheader": "Edit summary that is shown if you enable 
\"Prompt me when entering a blank summary\" and add a new section without 
headline to a talk page.\n\nSee also:\n* {{msg-mw|Missingsummary}}\n* 
{{msg-mw|Savearticle}}",
        "summary-preview": "Preview of the edit summary, shown under the edit 
summary itself.\nShould match: {{msg-mw|summary}}.",
        "subject-preview": "Should match {{msg-mw|subject}}",
+       "previewerrortext: "When a user has the editing preference LivePreview 
enabled, clicked the Preview or Show Changes button in the edit page and the 
action did not succeed.",
        "blockedtitle": "Used as title displayed for blocked users. The 
corresponding message body is one of the following messages:\n* 
{{msg-mw|Blockedtext|notext=1}}\n* {{msg-mw|Autoblockedtext|notext=1}}",
        "blockedtext": "Text displayed to blocked users.\n\n\"email this user\" 
should be consistent with {{msg-mw|Emailuser}}.\n\nParameters:\n* $1 - the 
blocking sysop (with a link to his/her userpage)\n* $2 - the reason for the 
block\n* $3 - the current IP address of the blocked user\n* $4 - (Unused) the 
blocking sysop's username (plain text, without the link)\n* $5 - the unique 
numeric identifier of the applied autoblock\n* $6 - the expiry of the block\n* 
$7 - the intended target of the block (what the blocking user specified in the 
blocking form)\n* $8 - the timestamp when the block started\nSee also:\n* 
{{msg-mw|Grouppage-sysop}}\n* {{msg-mw|Autoblockedtext}}",
        "autoblockedtext": "Text displayed to automatically blocked 
users.\n\n\"email this user\" should be consistent with 
{{msg-mw|Emailuser}}.\n\nParameters:\n* $1 - the blocking sysop (with a link to 
his/her userpage)\n* $2 - the reason for the block (in case of autoblocks: 
{{msg-mw|autoblocker}})\n* $3 - the current IP address of the blocked user\n* 
$4 - (Unused) the blocking sysop's username (plain text, without the link). Use 
it for GENDER.\n* $5 - the unique numeric identifier of the applied 
autoblock\n* $6 - the expiry of the block\n* $7 - the intended target of the 
block (what the blocking user specified in the blocking form)\n* $8 - the 
timestamp when the block started\nSee also:\n* {{msg-mw|Grouppage-sysop}}\n* 
{{msg-mw|Blockedtext}}",
diff --git a/resources/Resources.php b/resources/Resources.php
index 965c783..abc455e 100644
--- a/resources/Resources.php
+++ b/resources/Resources.php
@@ -1063,6 +1063,7 @@
                        'mediawiki.api',
                        'mediawiki.action.history.diff',
                        'mediawiki.util',
+                       'mediawiki.notify',
                        'mediawiki.jqueryMsg',
                ),
                'messages' => array(
@@ -1070,6 +1071,7 @@
                        'tooltip-p-lang',
                        'summary-preview',
                        'parentheses',
+                       'previewerrortext',
                ),
        ),
        'mediawiki.action.edit.stash' => array(
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js 
b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js
index e4ccf2b..68029aa 100644
--- a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js
@@ -206,6 +206,14 @@
                        $copyElements.animate( {
                                opacity: 1
                        }, 'fast' );
+               } ).fail( function ( code, result ) {
+                       if ( code === 'http' ) {
+                               mw.log.warn( 'Preview or Diff failed due to an 
HTTP error: ' +  result.textStatus );
+                       } else {
+                               mw.log.warn( 'Preview or Diff failed with API 
error: ' +  code );
+                       }
+                       // Report to user about the error
+                       mw.notify( mw.msg( 'previewerrortext' ), { tag: 
'js-preview-error' } );
                } );
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic52311839c175a213065eec442e50b4de0463822
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: TheDJ <hartman.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to