Add check for editing restriction widget on Special:Block
authorThalia <thalia.e.chan@googlemail.com>
Thu, 3 Jan 2019 10:59:20 +0000 (10:59 +0000)
committerThalia <thalia.e.chan@googlemail.com>
Thu, 3 Jan 2019 10:59:20 +0000 (10:59 +0000)
If partial blocks is not enabled, editing restriction widget
will not exist, so check before binding events.

Bug: T212808
Change-Id: I33fd7efdc24c026338e25d7c0751d31bc9a7baba

resources/src/mediawiki.special.block.js

index 255b878..89bbbc8 100644 (file)
@@ -67,7 +67,9 @@
                        // Bind functions so they're checked whenever stuff changes
                        blockTargetWidget.on( 'change', updateBlockOptions );
                        expiryWidget.on( 'change', updateBlockOptions );
-                       editingRestrictionWidget.on( 'change', updateBlockOptions );
+                       if ( editingRestrictionWidget ) {
+                               editingRestrictionWidget.on( 'change', updateBlockOptions );
+                       }
 
                        // Call them now to set initial state (ie. Special:Block/Foobar?wpBlockExpiry=2+hours)
                        updateBlockOptions();