jenkins-bot has submitted this change and it was merged.
Change subject: Move setting of minor/watch defaults from MWSaveDialog to Target
......................................................................
Move setting of minor/watch defaults from MWSaveDialog to Target
It looks like it also came from there originally, because it uses
this.pageExists which doesn't even exist in MWSaveDialog. This caused
all pages, even existing pages, to be watched when 'watchcreations'
was set.
This logic really belongs server-side, though.
Bug: 56206
Change-Id: Idf500383b27a93136dc0cfdd60a2e7b2607af95c
---
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
M modules/ve-mw/init/ve.init.mw.Target.js
M modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
3 files changed, 21 insertions(+), 20 deletions(-)
Approvals:
Krinkle: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index 27f3df5..24fead7 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -907,9 +907,8 @@
// Firefox has Object.prototype.watch
options.watch = undefined;
}
- this.saveDialog.$saveOptions
- .find( '.ve-ui-mwSaveDialog-checkboxes' )
- .find( 'input:not(#wpMinoredit, #wpWatchthis)' )
+ this.$checkboxes
+ .not( '#wpMinoredit, #wpWatchthis' )
.each( function () {
var $this = $( this );
// We can't just use $this.val() because .val() always
returns the value attribute of
@@ -1219,7 +1218,7 @@
} );
// Setup edit summary and checkboxes
this.saveDialog.setEditSummary( this.initialEditSummary );
- this.saveDialog.setupCheckboxes( ve.getObjectValues( this.checkboxes
).join( '\n' ) );
+ this.saveDialog.setupCheckboxes( this.$checkboxes );
};
/**
diff --git a/modules/ve-mw/init/ve.init.mw.Target.js
b/modules/ve-mw/init/ve.init.mw.Target.js
index 3d2c588..a1e9faa 100644
--- a/modules/ve-mw/init/ve.init.mw.Target.js
+++ b/modules/ve-mw/init/ve.init.mw.Target.js
@@ -68,7 +68,7 @@
this.startTimeStamp = null;
this.doc = null;
this.editNotices = null;
- this.checkboxes = null;
+ this.$checkboxes = null;
this.remoteNotices = [];
this.localNoticeMessages = [];
this.isMobileDevice = (
@@ -190,7 +190,18 @@
this.doc = ve.createDocumentFromHtml( this.originalHtml );
this.remoteNotices = ve.getObjectValues( data.notices );
- this.checkboxes = data.checkboxes;
+ this.$checkboxes = $( ve.getObjectValues( data.checkboxes
).join( '' ) );
+ // Populate checkboxes with default values for minor and watch
+ this.$checkboxes
+ .filter( '#wpMinoredit' )
+ .prop( 'checked', mw.user.options.get(
'minordefault' ) )
+ .end()
+ .filter( '#wpWatchthis' )
+ .prop( 'checked',
+ mw.user.options.get( 'watchdefault' ) ||
+ ( mw.user.options.get( 'watchcreations'
) && !this.pageExists ) ||
+ mw.config.get( 'wgVisualEditor'
).isPageWatched
+ );
this.baseTimeStamp = data.basetimestamp;
this.startTimeStamp = data.starttimestamp;
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
index 40efb00..4b0fb2f 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
@@ -240,27 +240,18 @@
*
* This method is safe to call even when the dialog hasn't been initialized
yet.
*
- * @param {string} checkboxes Multiline HTML
+ * @param {jQuery} $checkboxes jQuery collection of checkboxes
*/
-ve.ui.MWSaveDialog.prototype.setupCheckboxes = function ( checkboxes ) {
+ve.ui.MWSaveDialog.prototype.setupCheckboxes = function ( $checkboxes ) {
var saveDialog = this;
this.setupDeferred.done( function () {
saveDialog.$saveOptions.find( '.ve-ui-mwSaveDialog-checkboxes' )
- .html( checkboxes )
+ .html( $checkboxes )
.find( 'a' )
.attr( 'target', '_blank' )
.end()
- .find( '#wpMinoredit' )
- .prop( 'checked', mw.user.options.get(
'minordefault' ) )
- .prop( 'tabIndex', 0 )
- .end()
- .find( '#wpWatchthis' )
- .prop( 'checked',
- mw.user.options.get( 'watchdefault' ) ||
- ( mw.user.options.get( 'watchcreations'
) && !this.pageExists ) ||
- mw.config.get( 'wgVisualEditor'
).isPageWatched
- ).prop( 'tabIndex', 0 );
- // TODO: Need to set all checkboxes provided by api tabindex to
0 for proper accessibility
+ .find( 'input' )
+ .prop( 'tabIndex', 0 );
} );
};
--
To view, visit https://gerrit.wikimedia.org/r/95729
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idf500383b27a93136dc0cfdd60a2e7b2607af95c
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Robmoen <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits