From 56b427c9839833cdbd53f024e0b2819acc797b90 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Tue, 18 Apr 2017 08:59:08 -0700 Subject: [PATCH] postEdit: Show a different success messsage on publish vs. save wikis Bug: T183901 Change-Id: I065f733bd8b27bda68023cd1b718e257fd135aa2 --- includes/EditPage.php | 12 +++++++++++- languages/i18n/en.json | 1 + languages/i18n/qqq.json | 1 + resources/Resources.php | 1 + .../mediawiki.action.view.postEdit.js | 7 ++++++- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 72c3c14194..69744f6ced 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2452,12 +2452,22 @@ class EditPage { $displayTitle = $contextTitle->getPrefixedText(); } $out->setPageTitle( $this->context->msg( $msg, $displayTitle ) ); + + $config = $this->context->getConfig(); + # Transmit the name of the message to JavaScript for live preview # Keep Resources.php/mediawiki.action.edit.preview in sync with the possible keys $out->addJsConfigVars( [ 'wgEditMessage' => $msg, - 'wgAjaxEditStash' => $this->context->getConfig()->get( 'AjaxEditStash' ), + 'wgAjaxEditStash' => $config->get( 'AjaxEditStash' ), ] ); + + // Add whether to use 'save' or 'publish' messages to JavaScript for post-edit, other + // editors, etc. + $out->addJsConfigVars( + 'wgEditSubmitButtonLabelPublish', + $config->get( 'EditSubmitButtonLabelPublish' ) + ); } /** diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 42ea35cd35..20db368370 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -745,6 +745,7 @@ "postedit-confirmation-created": "The page has been created.", "postedit-confirmation-restored": "The page has been restored.", "postedit-confirmation-saved": "Your edit was saved.", + "postedit-confirmation-published": "Your edit was published.", "edit-already-exists": "Could not create a new page.\nIt already exists.", "addsection-preload": "", "addsection-editintro": "", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 6621e72a4f..2070e7af40 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -940,6 +940,7 @@ "postedit-confirmation-created": "{{gender}}\nShown after a user creates a new page. Parameters:\n* $1 - the current user, for GENDER support", "postedit-confirmation-restored": "{{gender}}\nShown after a user restores a page to a previous revision. Parameters:\n* $1 - the current user, for GENDER support", "postedit-confirmation-saved": "{{gender}}\nShown after a user saves a page. Parameters:\n* $1 - the current user, for GENDER support", + "postedit-confirmation-published": "{{gender}}\nShown after a user publishes a page. Parameters:\n* $1 - the current user, for GENDER support", "edit-already-exists": "Used as error message.\n\nSee also:\n* {{msg-mw|edit-hook-aborted}}\n* {{msg-mw|edit-gone-missing}}\n* {{msg-mw|edit-conflict}}\n* {{msg-mw|edit-no-change}}", "addsection-preload": "{{notranslate}}", "addsection-editintro": "{{notranslate}}", diff --git a/resources/Resources.php b/resources/Resources.php index 109ab7d6f0..04f86e6fe4 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -1508,6 +1508,7 @@ return [ 'postedit-confirmation-created', 'postedit-confirmation-restored', 'postedit-confirmation-saved', + 'postedit-confirmation-published', ], ], 'mediawiki.action.view.redirect' => [ diff --git a/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js index e0ab45a109..5e859ac8a0 100644 --- a/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js +++ b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js @@ -38,7 +38,12 @@ data = data || {}; if ( data.message === undefined ) { - data.message = $.parseHTML( mw.message( 'postedit-confirmation-saved', data.user || mw.user ).escaped() ); + data.message = $.parseHTML( mw.message( + mw.config.get( 'wgEditSubmitButtonLabelPublish' ) ? + 'postedit-confirmation-published' : + 'postedit-confirmation-saved', + data.user || mw.user + ).escaped() ); } $content = $( '
' ).addClass( 'postedit-icon postedit-icon-checkmark postedit-content' ); -- 2.20.1