Add new rules when user is blocked for UTP
[lhc/web/wiklou.git] / resources / src / mediawiki.special.block.js
index 441b1d6..255b878 100644 (file)
@@ -20,6 +20,7 @@
                        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 ) {