watchUserField = infuseIfExists( $( '#mw-input-wpWatch' ).closest( '.oo-ui-fieldLayout' ) ),
expiryWidget = infuseIfExists( $( '#mw-input-wpExpiry' ) ),
editingRestrictionWidget = infuseIfExists( $( '#mw-input-wpEditingRestriction' ) ),
+ preventTalkPageEdit = infuseIfExists( $( '#mw-input-wpDisableUTEdit' ) ),
pageRestrictionsWidget = infuseIfExists( $( '#mw-input-wpPageRestrictions' ) );
function updateBlockOptions() {
if ( pageRestrictionsWidget ) {
pageRestrictionsWidget.setDisabled( editingRestrictionValue === 'sitewide' );
}
+ if ( preventTalkPageEdit ) {
+ // TODO: (T210475) this option is disabled for partial blocks unless
+ // a namespace restriction for User_talk namespace is in place.
+ // This needs to be updated once Namespace restrictions is available
+ if ( editingRestrictionValue === 'partial' ) {
+ preventTalkPageEdit.setDisabled( true );
+ } else {
+ preventTalkPageEdit.setDisabled( false );
+ }
+ }
+
}
if ( blockTargetWidget ) {
return [
'Basic operation' => [ 'Test page', true ],
'User talk page, not allowed' => [ self::USER_TALK_PAGE, true, [
- 'allowUsertalk' => false,
- ] ],
- 'User talk page, allowed' => [ self::USER_TALK_PAGE, false, [
- 'allowUsertalk' => true,
- ] ],
- 'User talk page, allowed but $wgBlockAllowsUTEdit is false' => [ self::USER_TALK_PAGE, true, [
- 'allowUsertalk' => true,
- 'blockAllowsUTEdit' => false,
- ] ],
-
- 'Partial block, blocking the page' => [ 'Test page', true, [
- 'pageRestrictions' => [ 'Test page' ],
- ] ],
- 'Partial block, not blocking the page' => [ 'Test page 2', false, [
- 'pageRestrictions' => [ 'Test page' ],
- ] ],
- 'Partial block, overriding allowUsertalk' => [ self::USER_TALK_PAGE, true, [
- 'allowUsertalk' => false,
- 'pageRestrictions' => [ self::USER_TALK_PAGE ],
- ] ],
- 'Partial block, allowing user talk' => [ self::USER_TALK_PAGE, false, [
- 'allowUsertalk' => true,
- 'pageRestrictions' => [ 'Test page' ],
- ] ],
- 'Partial block, not allowing user talk' => [ self::USER_TALK_PAGE, true, [
- 'allowUsertalk' => false,
- 'pageRestrictions' => [ 'Test page' ],
- ] ],
+ 'allowUsertalk' => false,
+ ]
+ ],
+ 'User talk page, allowed' => [
+ self::USER_TALK_PAGE, false, [
+ 'allowUsertalk' => true,
+ ]
+ ],
+ 'User talk page, allowed but $wgBlockAllowsUTEdit is false' => [
+ self::USER_TALK_PAGE, true, [
+ 'allowUsertalk' => true,
+ 'blockAllowsUTEdit' => false,
+ ]
+ ],
+ 'Partial block, blocking the page' => [
+ 'Test page', true, [
+ 'pageRestrictions' => [ 'Test page' ],
+ ]
+ ],
+ 'Partial block, not blocking the page' => [
+ 'Test page 2', false, [
+ 'pageRestrictions' => [ 'Test page' ],
+ ]
+ ],
+ 'Partial block, allowing user talk' => [
+ self::USER_TALK_PAGE, false, [
+ 'allowUsertalk' => false,
+ 'pageRestrictions' => [ 'Test page' ],
+ ]
+ ],
+ 'Partial block, not allowing user talk' => [
+ self::USER_TALK_PAGE, true, [
+ 'allowUsertalk' => true,
+ 'pageRestrictions' => [ self::USER_TALK_PAGE ],
+ ]
+ ],
+ 'Partial block, allowing user talk but $wgBlockAllowsUTEdit is false' => [
+ self::USER_TALK_PAGE, false, [
+ 'allowUsertalk' => false,
+ 'pageRestrictions' => [ 'Test page' ],
+ 'blockAllowsUTEdit' => false,
+ ]
+ ],
+ 'Partial block, not allowing user talk with $wgBlockAllowsUTEdit set to false' => [
+ self::USER_TALK_PAGE, true, [
+ 'allowUsertalk' => true,
+ 'pageRestrictions' => [ self::USER_TALK_PAGE ],
+ 'blockAllowsUTEdit' => false,
+ ]
+ ],
];
}