mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
mw: Remove 'Report problem' feature
Removed the "report" slide from the mw.ViewPageTarget save dialog and everything that becomes obsolete as a result of it: * JS saveDialogReviewWrongButton, which pointed to the report slide (was already hidden as of I90de95f6337ee). * JS ve.init.mw.Target#reportProblem. * JS ve.init.mw.ViewPageTarget#diffHtml. * JS ve.dm.ElementLinearData#getUsedStoreValues. * PHP mw.config wgVisualEditorConfig.reportProblemURL. * PHP $wgVisualEditorParsoidProblemReportURL. * I18N visualeditor-savedialog-title-report. * I18N visualeditor-savedialog-label-review-wrong Change-Id: I8a5e0ab2060d7c14086bba413d4c7d73b29c9b97
This commit is contained in:
parent
d5868a0f13
commit
a0d764b8ee
|
@ -78,15 +78,12 @@ class VisualEditorHooks {
|
|||
* Adds extra variables to the global config
|
||||
*/
|
||||
public static function onResourceLoaderGetConfigVars( array &$vars ) {
|
||||
global $wgVisualEditorEnableSectionEditLinks, $wgVisualEditorParsoidProblemReportURL,
|
||||
global $wgVisualEditorEnableSectionEditLinks,
|
||||
$wgVisualEditorParsoidURL, $wgVisualEditorEnableExperimentalCode,
|
||||
$wgVisualEditorTabLayout;
|
||||
|
||||
$vars['wgVisualEditorConfig'] = array(
|
||||
'enableSectionEditLinks' => $wgVisualEditorEnableSectionEditLinks,
|
||||
'reportProblemURL' => $wgVisualEditorParsoidProblemReportURL !== null ?
|
||||
$wgVisualEditorParsoidProblemReportURL :
|
||||
"$wgVisualEditorParsoidURL/_bugs/",
|
||||
'enableExperimentalCode' => $wgVisualEditorEnableExperimentalCode,
|
||||
'tabLayout' => $wgVisualEditorTabLayout,
|
||||
);
|
||||
|
|
|
@ -41,9 +41,7 @@ $messages['en'] = array(
|
|||
'visualeditor-savedialog-title-conflict' => 'Conflict',
|
||||
'visualeditor-savedialog-title-nochanges' => 'No changes',
|
||||
'visualeditor-savedialog-title-review' => 'Review your changes',
|
||||
'visualeditor-savedialog-title-report' => 'Report a problem with the editing system',
|
||||
'visualeditor-savedialog-title-save' => 'Save your changes',
|
||||
'visualeditor-savedialog-label-review-wrong' => 'Report a bug',
|
||||
'visualeditor-savedialog-label-review-good' => 'Return to save form',
|
||||
'visualeditor-savedialog-label-report' => 'Report problem',
|
||||
'visualeditor-savedialog-label-resolve-conflict' => 'Resolve conflict',
|
||||
|
|
|
@ -18,9 +18,6 @@ $wgVisualEditorParsoidURL = 'http://localhost:8000';
|
|||
$wgVisualEditorParsoidPrefix = 'localhost';
|
||||
// Timeout for HTTP requests to Parsoid in seconds
|
||||
$wgVisualEditorParsoidTimeout = 100;
|
||||
// URL to post reports from the "Report problem" dialog to
|
||||
// Defaults to "$wgVisualEditorParsoidURL/_bugs/" if null
|
||||
$wgVisualEditorParsoidProblemReportURL = null;
|
||||
// Namespaces to enable VisualEditor in
|
||||
$wgVisualEditorNamespaces = array( NS_MAIN );
|
||||
// Whether to use change tagging for VisualEditor edits
|
||||
|
@ -179,9 +176,7 @@ $wgResourceModules += array(
|
|||
'visualeditor-savedialog-title-conflict',
|
||||
'visualeditor-savedialog-title-nochanges',
|
||||
'visualeditor-savedialog-title-review',
|
||||
'visualeditor-savedialog-title-report',
|
||||
'visualeditor-savedialog-title-save',
|
||||
'visualeditor-savedialog-label-review-wrong',
|
||||
'visualeditor-savedialog-label-review-good',
|
||||
'visualeditor-savedialog-label-report',
|
||||
'visualeditor-savedialog-label-resolve-conflict',
|
||||
|
|
|
@ -37,9 +37,7 @@ ve.init.mw.ViewPageTarget = function VeInitMwViewPageTarget() {
|
|||
this.toolbarSaveButton = null;
|
||||
this.saveDialogSlideHistory = [];
|
||||
this.saveDialogSaveButton = null;
|
||||
this.saveDialogReviewWrongButton = null;
|
||||
this.saveDialogReviewGoodButton = null;
|
||||
this.saveDialogReportButton = null;
|
||||
|
||||
this.$toolbarEditNotices = $( '<div>' ).addClass(
|
||||
've-init-mw-viewPageTarget-toolbar-editNotices'
|
||||
|
@ -219,20 +217,6 @@ ve.init.mw.ViewPageTarget.saveDialogTemplate = '\
|
|||
</div>\
|
||||
<div style="clear: both;"></div>\
|
||||
</div>\
|
||||
<div class="ve-init-mw-viewPageTarget-saveDialog-slide ve-init-mw-viewPageTarget-saveDialog-slide-report">\
|
||||
<div class="ve-init-mw-viewPageTarget-saveDialog-report">\
|
||||
<textarea name="problem" class="ve-init-mw-viewPageTarget-saveDialog-problem"\
|
||||
id="ve-init-mw-viewPageTarget-saveDialog-problem" type="text"\
|
||||
rows="4"></textarea>\
|
||||
</div>\
|
||||
<div class="ve-init-mw-viewPageTarget-saveDialog-actions">\
|
||||
<div class="ve-init-mw-viewPageTarget-saveDialog-working"></div>\
|
||||
</div>\
|
||||
<div style="clear: both;"></div>\
|
||||
<div class="ve-init-mw-viewPageTarget-saveDialog-foot">\
|
||||
<p class="ve-init-mw-viewPageTarget-saveDialog-report-notice"></p>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="ve-init-mw-viewPageTarget-saveDialog-slide ve-init-mw-viewPageTarget-saveDialog-slide-conflict">\
|
||||
<div class="ve-init-mw-viewPageTarget-saveDialog-conflict">\
|
||||
</div>\
|
||||
|
@ -443,9 +427,6 @@ ve.init.mw.ViewPageTarget.prototype.onShowChanges = function ( diffHtml ) {
|
|||
// Invalidate the viewer diff on next change
|
||||
this.surface.getModel().connect( this, { 'transact': 'onSurfaceModelTransact' } );
|
||||
|
||||
// Store the diff for reporting purposes
|
||||
this.diffHtml = diffHtml;
|
||||
|
||||
mw.loader.using( 'mediawiki.action.history.diff', ve.bind( function () {
|
||||
this.$saveDialog
|
||||
.find( '.ve-init-mw-viewPageTarget-saveDialog-viewer' )
|
||||
|
@ -453,7 +434,6 @@ ve.init.mw.ViewPageTarget.prototype.onShowChanges = function ( diffHtml ) {
|
|||
|
||||
this.$saveDialogLoadingIcon.hide();
|
||||
this.saveDialogReviewGoodButton.setDisabled( false );
|
||||
this.saveDialogReviewWrongButton.setDisabled( false );
|
||||
|
||||
}, this ), ve.bind( function () {
|
||||
this.onSaveError( null, 'Module load failed' );
|
||||
|
@ -476,7 +456,6 @@ ve.init.mw.ViewPageTarget.prototype.onSerialize = function ( wikitext ) {
|
|||
|
||||
this.$saveDialogLoadingIcon.hide();
|
||||
this.saveDialogReviewGoodButton.setDisabled( false );
|
||||
this.saveDialogReviewWrongButton.setDisabled( false );
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -489,7 +468,6 @@ ve.init.mw.ViewPageTarget.prototype.onSerialize = function ( wikitext ) {
|
|||
ve.init.mw.ViewPageTarget.prototype.onShowChangesError = function ( jqXHR, status ) {
|
||||
alert( ve.msg( 'visualeditor-differror', status ) );
|
||||
this.$saveDialogLoadingIcon.hide();
|
||||
this.saveDialogReviewWrongButton.setDisabled( false );
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -502,7 +480,6 @@ ve.init.mw.ViewPageTarget.prototype.onShowChangesError = function ( jqXHR, statu
|
|||
ve.init.mw.ViewPageTarget.prototype.onSerializeError = function ( jqXHR, status ) {
|
||||
alert( ve.msg( 'visualeditor-serializeerror', status ) );
|
||||
this.$saveDialogLoadingIcon.hide();
|
||||
this.saveDialogReviewWrongButton.setDisabled( false );
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -692,15 +669,6 @@ ve.init.mw.ViewPageTarget.prototype.onSaveDialogSaveButtonClick = function () {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle clicks on the review "Wrong" button in the save dialog.
|
||||
*
|
||||
* @method
|
||||
*/
|
||||
ve.init.mw.ViewPageTarget.prototype.onSaveDialogReviewWrongButtonClick = function () {
|
||||
this.swapSaveDialog( 'report' );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle clicks on the review "Good" button in the save dialog.
|
||||
*
|
||||
|
@ -710,18 +678,6 @@ ve.init.mw.ViewPageTarget.prototype.onSaveDialogReviewGoodButtonClick = function
|
|||
this.swapSaveDialog( 'save' );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle clicks on the report a problem button in the save dialog.
|
||||
*
|
||||
* @method
|
||||
*/
|
||||
ve.init.mw.ViewPageTarget.prototype.onSaveDialogReportButtonClick = function () {
|
||||
this.reportProblem( $( '#ve-init-mw-viewPageTarget-saveDialog-problem' ).val() );
|
||||
this.resetSaveDialog();
|
||||
this.hideSaveDialog();
|
||||
mw.notify( ve.msg( 'visualeditor-notification-reported' ) );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle clicks on the resolve conflict button in the conflict dialog.
|
||||
*
|
||||
|
@ -1132,13 +1088,6 @@ ve.init.mw.ViewPageTarget.prototype.setupSaveDialog = function () {
|
|||
} );
|
||||
this.saveDialogReviewButton.connect( this, { 'click': 'onSaveDialogReviewButtonClick' } );
|
||||
|
||||
this.saveDialogReviewWrongButton = new ve.ui.ButtonWidget( {
|
||||
'label': ve.msg( 'visualeditor-savedialog-label-review-wrong' )
|
||||
} );
|
||||
this.saveDialogReviewWrongButton.connect(
|
||||
this, { 'click': 'onSaveDialogReviewWrongButtonClick' }
|
||||
);
|
||||
|
||||
this.saveDialogReviewGoodButton = new ve.ui.ButtonWidget( {
|
||||
'label': ve.msg( 'visualeditor-savedialog-label-review-good' ),
|
||||
'flags': ['constructive']
|
||||
|
@ -1147,12 +1096,6 @@ ve.init.mw.ViewPageTarget.prototype.setupSaveDialog = function () {
|
|||
this, { 'click': 'onSaveDialogReviewGoodButtonClick' }
|
||||
);
|
||||
|
||||
this.saveDialogReportButton = new ve.ui.ButtonWidget( {
|
||||
'label': ve.msg( 'visualeditor-savedialog-label-report' ),
|
||||
'flags': ['constructive']
|
||||
} );
|
||||
this.saveDialogReportButton.connect( this, { 'click': 'onSaveDialogReportButtonClick' } );
|
||||
|
||||
this.saveDialogResolveConflictButton = new ve.ui.ButtonWidget( {
|
||||
'label': ve.msg( 'visualeditor-savedialog-label-resolve-conflict' ),
|
||||
'flags': ['constructive']
|
||||
|
@ -1175,11 +1118,6 @@ ve.init.mw.ViewPageTarget.prototype.setupSaveDialog = function () {
|
|||
.prepend( viewPage.saveDialogReviewGoodButton.$ )
|
||||
.end()
|
||||
.end()
|
||||
.find( '.ve-init-mw-viewPageTarget-saveDialog-slide-report' )
|
||||
.find( '.ve-init-mw-viewPageTarget-saveDialog-actions' )
|
||||
.prepend( viewPage.saveDialogReportButton.$ )
|
||||
.end()
|
||||
.end()
|
||||
.find( '.ve-init-mw-viewPageTarget-saveDialog-slide-conflict' )
|
||||
.find( '.ve-init-mw-viewPageTarget-saveDialog-actions' )
|
||||
.prepend( viewPage.saveDialogResolveConflictButton.$ )
|
||||
|
@ -1240,27 +1178,6 @@ ve.init.mw.ViewPageTarget.prototype.setupSaveDialog = function () {
|
|||
.find( '.ve-init-mw-viewPageTarget-saveDialog-watchList-label' )
|
||||
.html( ve.init.platform.getParsedMessage( 'watchthis' ) )
|
||||
.end()
|
||||
.find( '#ve-init-mw-viewPageTarget-saveDialog-problem' )
|
||||
.attr( {
|
||||
'placeholder': ve.msg( 'visualeditor-problem' )
|
||||
} )
|
||||
.placeholder()
|
||||
.on( {
|
||||
'focus': function () {
|
||||
$(this).parent().addClass(
|
||||
've-init-mw-viewPageTarget-saveDialog-report-focused'
|
||||
);
|
||||
},
|
||||
'blur': function () {
|
||||
$(this).parent().removeClass(
|
||||
've-init-mw-viewPageTarget-saveDialog-report-focused'
|
||||
);
|
||||
}
|
||||
} )
|
||||
.end()
|
||||
.find( '.ve-init-mw-viewPageTarget-saveDialog-report-notice' )
|
||||
.html( ve.init.platform.getParsedMessage( 'visualeditor-report-notice' ) )
|
||||
.end()
|
||||
.find( '.ve-init-mw-viewPageTarget-saveDialog-license' )
|
||||
.html( ve.init.platform.getParsedMessage( 'copyrightwarning' ) )
|
||||
.end()
|
||||
|
@ -1366,9 +1283,6 @@ ve.init.mw.ViewPageTarget.prototype.resetSaveDialog = function () {
|
|||
.find( '#ve-init-mw-viewPageTarget-saveDialog-editSummary' )
|
||||
.val( '' )
|
||||
.end()
|
||||
.find( '#ve-init-mw-viewPageTarget-saveDialog-problem' )
|
||||
.val( '' )
|
||||
.end()
|
||||
.find( '#ve-init-mw-viewPageTarget-saveDialog-minorEdit' )
|
||||
.prop( 'checked', false )
|
||||
.end()
|
||||
|
@ -1381,7 +1295,7 @@ ve.init.mw.ViewPageTarget.prototype.resetSaveDialog = function () {
|
|||
* Swap state in the save dialog.
|
||||
*
|
||||
* @method
|
||||
* @param {string} slide One of 'save', 'review', 'report', 'conflict' or 'nochanges'
|
||||
* @param {string} slide One of 'save', 'review', 'conflict' or 'nochanges'
|
||||
* @param {Object} [options]
|
||||
* @param {boolean} [options.fromHistory] Whether this swap was triggered from interaction
|
||||
* with the slide history (e.g. surpresses pushing of target slide in the history again).
|
||||
|
@ -1392,7 +1306,7 @@ ve.init.mw.ViewPageTarget.prototype.swapSaveDialog = function ( slide, options )
|
|||
var $slide, $viewer,
|
||||
doc = this.surface.getModel().getDocument();
|
||||
|
||||
if ( ve.indexOf( slide, [ 'save', 'review', 'report', 'conflict', 'nochanges' ] ) === -1 ) {
|
||||
if ( ve.indexOf( slide, [ 'save', 'review', 'conflict', 'nochanges' ] ) === -1 ) {
|
||||
throw new Error( 'Unknown saveDialog slide: ' + slide );
|
||||
}
|
||||
|
||||
|
@ -1412,7 +1326,6 @@ ve.init.mw.ViewPageTarget.prototype.swapSaveDialog = function ( slide, options )
|
|||
// Update title to one of:
|
||||
// - visualeditor-savedialog-title-save
|
||||
// - visualeditor-savedialog-title-review
|
||||
// - visualeditor-savedialog-title-report
|
||||
// - visualeditor-savedialog-title-conflict
|
||||
// - visualeditor-savedialog-title-nochanges
|
||||
.find( '.ve-init-mw-viewPageTarget-saveDialog-title' )
|
||||
|
@ -1427,7 +1340,6 @@ ve.init.mw.ViewPageTarget.prototype.swapSaveDialog = function ( slide, options )
|
|||
$viewer = $slide.find( '.ve-init-mw-viewPageTarget-saveDialog-viewer' );
|
||||
if ( !$viewer.find( 'table, pre' ).length ) {
|
||||
this.saveDialogReviewGoodButton.setDisabled( true );
|
||||
this.saveDialogReviewWrongButton.setDisabled( true );
|
||||
this.$saveDialogLoadingIcon.show();
|
||||
if ( this.pageExists ) {
|
||||
// Has no callback, handled via target.onShowChanges
|
||||
|
@ -1452,7 +1364,7 @@ ve.init.mw.ViewPageTarget.prototype.swapSaveDialog = function ( slide, options )
|
|||
// Show the target slide
|
||||
$slide.show();
|
||||
|
||||
if ( slide === 'save' || slide === 'report' ) {
|
||||
if ( slide === 'save' ) {
|
||||
setTimeout( function () {
|
||||
$slide.find( 'textarea' ).eq( 0 ).focus();
|
||||
} );
|
||||
|
|
|
@ -702,48 +702,3 @@ ve.init.mw.Target.prototype.serialize = function ( doc, callback ) {
|
|||
} );
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Send a problem report to the Parsoid API.
|
||||
*
|
||||
* @method
|
||||
* @param {string} message
|
||||
*/
|
||||
ve.init.mw.Target.prototype.reportProblem = function ( message ) {
|
||||
// Gather reporting information
|
||||
var now = new Date(),
|
||||
doc = this.surface.getModel().getDocument(),
|
||||
editedData = doc.getFullData(),
|
||||
store = doc.getStore(),
|
||||
internalList = doc.getInternalList(),
|
||||
report = {
|
||||
'title': this.pageName,
|
||||
'oldid': this.oldid,
|
||||
'timestamp': now.getTime() + 60000 * now.getTimezoneOffset(),
|
||||
'message': message,
|
||||
'diff': this.diffHtml,
|
||||
'originalHtml': this.originalHtml,
|
||||
'originalData':
|
||||
// originalHtml only has the body's HTML for now, see TODO comment in
|
||||
// ve.init.mw.ViewPageTarget.prototype.setupSurface
|
||||
// FIXME: need to expand this data before sending it, see bug 47319
|
||||
ve.dm.converter.getDataFromDom(
|
||||
ve.createDocumentFromHtml( '<body>' + this.originalHtml + '</body>' ),
|
||||
store, internalList
|
||||
).getData(),
|
||||
'editedData': editedData,
|
||||
'editedHtml': this.getHtml(
|
||||
ve.dm.converter.getDomFromData( editedData, store, internalList )
|
||||
),
|
||||
'store': doc.data.getUsedStoreValues(),
|
||||
'wiki': mw.config.get( 'wgDBname' )
|
||||
};
|
||||
$.post(
|
||||
mw.config.get( 'wgVisualEditorConfig' ).reportProblemURL,
|
||||
{ 'data': JSON.stringify( ve.copyObject( report, ve.convertDomElements ) ) },
|
||||
function () {
|
||||
// This space intentionally left blank
|
||||
},
|
||||
'text'
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue