postEdit: Show a different success messsage on publish vs. save wikis
authorJames D. Forrester <jforrester@wikimedia.org>
Tue, 18 Apr 2017 15:59:08 +0000 (08:59 -0700)
committerJames D. Forrester <jforrester@wikimedia.org>
Tue, 30 Jan 2018 19:18:59 +0000 (11:18 -0800)
Bug: T183901
Change-Id: I065f733bd8b27bda68023cd1b718e257fd135aa2

includes/EditPage.php
languages/i18n/en.json
languages/i18n/qqq.json
resources/Resources.php
resources/src/mediawiki.action/mediawiki.action.view.postEdit.js

index 72c3c14..69744f6 100644 (file)
@@ -2452,12 +2452,22 @@ class EditPage {
                        $displayTitle = $contextTitle->getPrefixedText();
                }
                $out->setPageTitle( $this->context->msg( $msg, $displayTitle ) );
                        $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,
                # 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' )
+               );
        }
 
        /**
        }
 
        /**
index 42ea35c..20db368 100644 (file)
        "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-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": "",
        "edit-already-exists": "Could not create a new page.\nIt already exists.",
        "addsection-preload": "",
        "addsection-editintro": "",
index 6621e72..2070e7a 100644 (file)
        "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-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}}",
        "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}}",
index 109ab7d..04f86e6 100644 (file)
@@ -1508,6 +1508,7 @@ return [
                        'postedit-confirmation-created',
                        'postedit-confirmation-restored',
                        'postedit-confirmation-saved',
                        'postedit-confirmation-created',
                        'postedit-confirmation-restored',
                        'postedit-confirmation-saved',
+                       'postedit-confirmation-published',
                ],
        ],
        'mediawiki.action.view.redirect' => [
                ],
        ],
        'mediawiki.action.view.redirect' => [
index e0ab45a..5e859ac 100644 (file)
                data = data || {};
 
                if ( data.message === undefined ) {
                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 = $( '<div>' ).addClass( 'postedit-icon postedit-icon-checkmark postedit-content' );
                }
 
                $content = $( '<div>' ).addClass( 'postedit-icon postedit-icon-checkmark postedit-content' );