From 371ac353cff5353db34009a87d46056875afdab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Fri, 21 Apr 2017 00:06:34 +0200 Subject: [PATCH] ve.init.mw.ArticleTarget: Use a simpler error message when site is read-only Sites like to customize 'readonlywarning' with things that we can't parse. Instead, use 'apierror-readonly'. The old message is still shown in edit notices. Bug: T163455 Change-Id: I592accde17b256ecee27820df12d9d312499f8f7 --- extension.json | 2 +- modules/ve-mw/init/ve.init.mw.ArticleTarget.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/extension.json b/extension.json index 90f9d1f91d..36b3a899c1 100644 --- a/extension.json +++ b/extension.json @@ -389,7 +389,7 @@ "editing", "lastmodifiedat", "parentheses", - "readonlywarning", + "apierror-readonly", "redirectpagesub", "subject", "visualeditor-loadwarning", diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js index 52204f4ec8..597a136225 100644 --- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js +++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js @@ -614,7 +614,7 @@ ve.init.mw.ArticleTarget.prototype.saveFail = function ( doc, saveData, jqXHR, s this.saveErrorHookAborted(); return; } else if ( data.error && data.error.code === 'readonly' ) { - this.saveErrorReadOnly( data.error.readonlyreason ); + this.saveErrorReadOnly(); return; } @@ -912,11 +912,10 @@ ve.init.mw.ArticleTarget.prototype.saveErrorPageDeleted = function () { * Handle read only error * * @method - * @param {string} reason The reason given by the system administrator. * @fires saveErrorReadOnly */ -ve.init.mw.ArticleTarget.prototype.saveErrorReadOnly = function ( reason ) { - this.showSaveError( $( $.parseHTML( mw.message( 'readonlywarning', reason ).parse() ) ), true, true ); +ve.init.mw.ArticleTarget.prototype.saveErrorReadOnly = function () { + this.showSaveError( $( $.parseHTML( mw.message( 'apierror-readonly' ).parse() ) ), true, true ); this.emit( 'saveErrorReadOnly' ); };