Bmansurov has uploaded a new change for review.

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

Change subject: Show the correct error message when saving in EditorOverlay 
when the database is in readonly mode.
......................................................................

Show the correct error message when saving in EditorOverlay when the database 
is in readonly mode.

Bug: 67514
Change-Id: I180050d6e0e583d03ee33991673d4567aea054e5
---
M i18n/en.json
M i18n/qqq.json
M javascripts/modules/editor/EditorOverlay.js
3 files changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/07/164407/1

diff --git a/i18n/en.json b/i18n/en.json
index 08b13f1..ed3257d 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -63,6 +63,7 @@
        "mobile-frontend-editor-error-conflict": "Error, another user has 
edited this page.",
        "mobile-frontend-editor-error-loading": "Error, can't load section.",
        "mobile-frontend-editor-error-preview": "Error, something unexpected 
happened upon loading the preview. Please close and try again.",
+       "mobile-frontend-editor-error-readonly": "Error, the wiki is currently 
in read-only mode.",
        "mobile-frontend-editor-keep-editing": "Keep editing",
        "mobile-frontend-editor-licensing": "By saving changes, you agree to 
release your contribution under the $1 license.",
        "mobile-frontend-editor-licensing-with-terms": "By saving changes, you 
agree to the $1 and agree to release your contribution under the $2 license.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 0db76d5..0978a3c 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -90,6 +90,7 @@
        "mobile-frontend-editor-error-conflict": "Text that displays when there 
has been edit conflict when saving a page edit.\n\nUsed as \"toast\" error 
message.",
        "mobile-frontend-editor-error-loading": "Text that displays when there 
have been errors when loading a page section in the editor.\n\nUsed as 
\"toast\" error message.",
        "mobile-frontend-editor-error-preview": "Error message for when a 
preview fails to load for an unknown reason",
+       "mobile-frontend-editor-error-readonly": "Error message for when saving 
fails due to readonly database.",
        "mobile-frontend-editor-keep-editing": "Caption for a button that takes 
you back to editing from edit preview screen.",
        "mobile-frontend-editor-licensing": "Text notifying user of license 
that text will be published under.\nParameters:\n* $1 - link to license",
        "mobile-frontend-editor-licensing-with-terms": "Text notifying user of 
license that text will be published under.\nParameters:\n* $1 - link to terms 
of service\n* $2 - link to license",
diff --git a/javascripts/modules/editor/EditorOverlay.js 
b/javascripts/modules/editor/EditorOverlay.js
index 860a97f..2089be0 100644
--- a/javascripts/modules/editor/EditorOverlay.js
+++ b/javascripts/modules/editor/EditorOverlay.js
@@ -253,7 +253,7 @@
 
                                        self.onSave();
                                } ).
-                               fail( function( data ) {
+                               fail( function( data, code, response ) {
                                        var msg;
 
                                        if ( data.type === 'captcha' ) {
@@ -264,6 +264,12 @@
                                        } else {
                                                if ( data.details === 
'editconflict' ) {
                                                        msg = mw.msg( 
'mobile-frontend-editor-error-conflict' );
+                                               } else if ( response.error && 
response.error.code === 'readonly' ) {
+                                                       if ( 
response.error.readonlyreason && response.error.info ) {
+                                                               msg = 
response.error.info;
+                                                       } else {
+                                                               msg = mw.msg( 
'mobile-frontend-editor-error-readonly' );
+                                                       }
                                                } else {
                                                        msg = mw.msg( 
'mobile-frontend-editor-error' );
                                                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I180050d6e0e583d03ee33991673d4567aea054e5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>

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

Reply via email to