From: Thalia Date: Wed, 13 Feb 2019 13:08:22 +0000 (+0000) Subject: Uncheck "create account" on Special:Block for partial blocks X-Git-Tag: 1.34.0-rc.0~2760^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=0dddebc82db2d4046167b2c6a02f21cb8e68405d;p=lhc%2Fweb%2Fwiklou.git Uncheck "create account" on Special:Block for partial blocks Set the default state for the checkbox for preventing a user from creating an account to unchecked, if the block is set to partial. However, if the user has already interacted with the checkbox, do not change its state just because the block type changes. Bug: T208510 Change-Id: If17b82b03553810508f22070865719bd1926949d --- diff --git a/resources/src/mediawiki.special.block.js b/resources/src/mediawiki.special.block.js index 58409b45c5..02e380ae59 100644 --- a/resources/src/mediawiki.special.block.js +++ b/resources/src/mediawiki.special.block.js @@ -24,7 +24,10 @@ editingRestrictionWidget = infuseIfExists( $( '#mw-input-wpEditingRestriction' ) ), preventTalkPageEdit = infuseIfExists( $( '#mw-input-wpDisableUTEdit' ) ), pageRestrictionsWidget = infuseIfExists( $( '#mw-input-wpPageRestrictions' ) ), - namespaceRestrictionsWidget = infuseIfExists( $( '#mw-input-wpNamespaceRestrictions' ) ); + namespaceRestrictionsWidget = infuseIfExists( $( '#mw-input-wpNamespaceRestrictions' ) ), + createAccountWidget = infuseIfExists( $( '#mw-input-wpCreateAccount' ) ), + userChangedCreateAccount = false, + updatingBlockOptions = false; function updateBlockOptions() { var blocktarget = blockTargetWidget.getValue().trim(), @@ -76,6 +79,11 @@ ) === -1 ); } + if ( !userChangedCreateAccount ) { + updatingBlockOptions = true; + createAccountWidget.setSelected( isSitewide ); + updatingBlockOptions = false; + } } @@ -93,6 +101,12 @@ namespaceRestrictionsWidget.on( 'change', updateBlockOptions ); } + createAccountWidget.on( 'change', function () { + if ( !updatingBlockOptions ) { + userChangedCreateAccount = true; + } + } ); + // Call them now to set initial state (ie. Special:Block/Foobar?wpBlockExpiry=2+hours) updateBlockOptions(); }