From 705199753cda720d61f3ff2e36724e5fc361ba55 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Thu, 10 Dec 2015 11:34:56 -0800 Subject: [PATCH] Let the feedback tool be configured for a remote wiki Bug: T92661 Change-Id: Id48729c89db208714f67fec1eabafe577a834b51 --- VisualEditor.hooks.php | 2 ++ extension.json | 2 ++ modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js | 18 +++++++++++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php index 09f5a62681..4d6c85abbf 100644 --- a/VisualEditor.hooks.php +++ b/VisualEditor.hooks.php @@ -587,6 +587,8 @@ class VisualEditorHooks { 'specialBooksources' => urldecode( SpecialPage::getTitleFor( 'Booksources' )->getPrefixedURL() ), 'restbaseUrl' => $coreConfig->get( 'VisualEditorRestbaseURL' ), 'fullRestbaseUrl' => $coreConfig->get( 'VisualEditorFullRestbaseURL' ), + 'feedbackApiUrl' => $veConfig->get( 'VisualEditorFeedbackAPIURL' ), + 'feedbackTitle' => $veConfig->get( 'VisualEditorFeedbackTitle' ), ); return true; diff --git a/extension.json b/extension.json index b10c0b8d43..3919800db6 100644 --- a/extension.json +++ b/extension.json @@ -29,6 +29,8 @@ }, "VisualEditorRestbaseURL": false, "VisualEditorFullRestbaseURL": false, + "VisualEditorFeedbackAPIURL": false, + "VisualEditorFeedbackTitle": false, "VisualEditorSerializationCacheTimeout": 3600, "VisualEditorUseChangeTagging": true, "VisualEditorSupportedSkins": [ diff --git a/modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js b/modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js index c58e0d15f2..339c460ed3 100644 --- a/modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js +++ b/modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js @@ -179,14 +179,26 @@ ve.ui.MWHelpPopupTool.prototype.onFeedbackClick = function () { this.popup.toggle( false ); if ( !this.feedbackPromise ) { this.feedbackPromise = mw.loader.using( 'mediawiki.feedback' ).then( function () { + var feedbackConfig, veConfig; + // This can't be constructed until the editor has loaded as it uses special messages - return new mw.Feedback( { - title: new mw.Title( ve.msg( 'visualeditor-feedback-link' ) ), + feedbackConfig = { bugsLink: new mw.Uri( 'https://phabricator.wikimedia.org/maniphest/task/create/?projects=VisualEditor' ), bugsListLink: new mw.Uri( 'https://phabricator.wikimedia.org/maniphest/query/eSHgNozkIsuv/' ), showUseragentCheckbox: true, useragentCheckboxMandatory: true - } ); + }; + + // If so configured, tell mw.feedback that we're posting to a remote wiki and set the title + veConfig = mw.config.get( 'wgVisualEditorConfig' ); + if ( veConfig.feedbackApiUrl ) { + feedbackConfig.apiUrl = veConfig.feedbackApiUrl; + feedbackConfig.title = new mw.Title( veConfig.feedbackTitle ); + } else { + feedbackConfig.title = new mw.Title( ve.msg( 'visualeditor-feedback-link' ) ); + } + + return new mw.Feedback( feedbackConfig ); } ); } this.feedbackPromise.done( function ( feedback ) {