Let the feedback tool be configured for a remote wiki

Bug: T92661
Change-Id: Id48729c89db208714f67fec1eabafe577a834b51
This commit is contained in:
James D. Forrester 2015-12-10 11:34:56 -08:00
parent 29f33a57d5
commit 705199753c
3 changed files with 19 additions and 3 deletions

View file

@ -587,6 +587,8 @@ class VisualEditorHooks {
'specialBooksources' => urldecode( SpecialPage::getTitleFor( 'Booksources' )->getPrefixedURL() ), 'specialBooksources' => urldecode( SpecialPage::getTitleFor( 'Booksources' )->getPrefixedURL() ),
'restbaseUrl' => $coreConfig->get( 'VisualEditorRestbaseURL' ), 'restbaseUrl' => $coreConfig->get( 'VisualEditorRestbaseURL' ),
'fullRestbaseUrl' => $coreConfig->get( 'VisualEditorFullRestbaseURL' ), 'fullRestbaseUrl' => $coreConfig->get( 'VisualEditorFullRestbaseURL' ),
'feedbackApiUrl' => $veConfig->get( 'VisualEditorFeedbackAPIURL' ),
'feedbackTitle' => $veConfig->get( 'VisualEditorFeedbackTitle' ),
); );
return true; return true;

View file

@ -29,6 +29,8 @@
}, },
"VisualEditorRestbaseURL": false, "VisualEditorRestbaseURL": false,
"VisualEditorFullRestbaseURL": false, "VisualEditorFullRestbaseURL": false,
"VisualEditorFeedbackAPIURL": false,
"VisualEditorFeedbackTitle": false,
"VisualEditorSerializationCacheTimeout": 3600, "VisualEditorSerializationCacheTimeout": 3600,
"VisualEditorUseChangeTagging": true, "VisualEditorUseChangeTagging": true,
"VisualEditorSupportedSkins": [ "VisualEditorSupportedSkins": [

View file

@ -179,14 +179,26 @@ ve.ui.MWHelpPopupTool.prototype.onFeedbackClick = function () {
this.popup.toggle( false ); this.popup.toggle( false );
if ( !this.feedbackPromise ) { if ( !this.feedbackPromise ) {
this.feedbackPromise = mw.loader.using( 'mediawiki.feedback' ).then( function () { 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 // This can't be constructed until the editor has loaded as it uses special messages
return new mw.Feedback( { feedbackConfig = {
title: new mw.Title( ve.msg( 'visualeditor-feedback-link' ) ),
bugsLink: new mw.Uri( 'https://phabricator.wikimedia.org/maniphest/task/create/?projects=VisualEditor' ), bugsLink: new mw.Uri( 'https://phabricator.wikimedia.org/maniphest/task/create/?projects=VisualEditor' ),
bugsListLink: new mw.Uri( 'https://phabricator.wikimedia.org/maniphest/query/eSHgNozkIsuv/' ), bugsListLink: new mw.Uri( 'https://phabricator.wikimedia.org/maniphest/query/eSHgNozkIsuv/' ),
showUseragentCheckbox: true, showUseragentCheckbox: true,
useragentCheckboxMandatory: 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 ) { this.feedbackPromise.done( function ( feedback ) {