Merge "parser: Replace Sanitizer::armorLinksCallback() with a closure"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 30 Jan 2018 20:02:16 +0000 (20:02 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 30 Jan 2018 20:02:16 +0000 (20:02 +0000)
includes/EditPage.php
languages/i18n/en.json
languages/i18n/qqq.json
resources/Resources.php
resources/src/mediawiki.action/mediawiki.action.view.postEdit.js
resources/src/mediawiki/mediawiki.feedback.js

index d49f205..6bf3c89 100644 (file)
@@ -2472,12 +2472,22 @@ ERROR;
                        $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' )
+               );
        }
 
        /**
index 3726ae9..a638833 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-published": "Your edit was published.",
        "edit-already-exists": "Could not create a new page.\nIt already exists.",
        "addsection-preload": "",
        "addsection-editintro": "",
index e29bcad..a4f1d64 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-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}}",
index 5a16641..2142f1f 100644 (file)
@@ -1508,6 +1508,7 @@ return [
                        'postedit-confirmation-created',
                        'postedit-confirmation-restored',
                        'postedit-confirmation-saved',
+                       'postedit-confirmation-published',
                ],
        ],
        'mediawiki.action.view.redirect' => [
index e0ab45a..5e859ac 100644 (file)
                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' );
index bfd5c06..ca4d239 100644 (file)
@@ -57,6 +57,7 @@
                this.feedbackPageTitle = config.title || new mw.Title( 'Feedback' );
 
                this.messagePosterPromise = mw.messagePoster.factory.create( this.feedbackPageTitle, config.apiUrl );
+               this.foreignApi = config.apiUrl ? new mw.ForeignApi( config.apiUrl ) : null;
 
                // Links
                this.bugsTaskSubmissionLink = config.bugsLink || '//phabricator.wikimedia.org/maniphest/task/edit/form/1/';
         * Respond to dialog submit event. If the information was
         * submitted successfully, open a MessageDialog to thank the user.
         *
-        * @param {string} [status] A status of the end of operation
+        * @param {string} status A status of the end of operation
         *  of the main feedback dialog. Empty if the dialog was
         *  dismissed with no action or the user followed the button
         *  to the external task reporting site.
+        * @param {string} feedbackPageName
+        * @param {string} feedbackPageUrl
         */
-       mw.Feedback.prototype.onDialogSubmit = function ( status ) {
+       mw.Feedback.prototype.onDialogSubmit = function ( status, feedbackPageName, feedbackPageUrl ) {
                var dialogConfig;
 
                if ( status !== 'submitted' ) {
                        title: mw.msg( 'feedback-thanks-title' ),
                        message: $( '<span>' ).msg(
                                'feedback-thanks',
-                               this.feedbackPageTitle.getNameText(),
+                               feedbackPageName,
                                $( '<a>' ).attr( {
                                        target: '_blank',
-                                       href: this.feedbackPageTitle.getUrl()
+                                       href: feedbackPageUrl
                                } )
                        ),
                        actions: [
                        this.constructor.static.dialog,
                        {
                                title: mw.msg( this.dialogTitleMessageKey ),
+                               foreignApi: this.foreignApi,
                                settings: {
                                        messagePosterPromise: this.messagePosterPromise,
                                        title: this.feedbackPageTitle,
         */
        mw.Feedback.Dialog.prototype.getSetupProcess = function ( data ) {
                return mw.Feedback.Dialog.parent.prototype.getSetupProcess.call( this, data )
+                       .next( function () {
+                               // Get the URL of the target page, we want to use that in links in the intro
+                               // and in the success dialog
+                               var dialog = this;
+                               if ( data.foreignApi ) {
+                                       return data.foreignApi.get( {
+                                               action: 'query',
+                                               prop: 'info',
+                                               inprop: 'url',
+                                               formatversion: 2,
+                                               titles: data.settings.title.getPrefixedText()
+                                       } ).then( function ( data ) {
+                                               dialog.feedbackPageUrl = OO.getProp( data, 'query', 'pages', 0, 'canonicalurl' );
+                                       } );
+                               } else {
+                                       this.feedbackPageUrl = data.settings.title.getUrl();
+                               }
+                       }, this )
                        .next( function () {
                                var plainMsg, parsedMsg,
                                        settings = data.settings;
                                this.setBugReportLink( settings.bugsTaskSubmissionLink );
                                this.feedbackPageTitle = settings.title;
                                this.feedbackPageName = settings.title.getNameText();
-                               this.feedbackPageUrl = settings.title.getUrl();
 
                                // Useragent checkbox
                                if ( settings.useragentCheckbox.show ) {