jenkins-bot has submitted this change and it was merged.

Change subject: ToolFactory: Allow '*' as an item in a toolgroup include list
......................................................................


ToolFactory: Allow '*' as an item in a toolgroup include list

Previously we only checked for the string value '*', but one
should also be able to specify ['ToolBefore', '*', 'ToolAfter'].

Bug: T133727
Change-Id: I1b161ffcb35241a5449b3c25b83adb959f807b14
---
M src/ToolFactory.js
1 file changed, 18 insertions(+), 16 deletions(-)

Approvals:
  Alex Monk: Looks good to me, but someone else must approve
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/ToolFactory.js b/src/ToolFactory.js
index 27d9222..c5dd93f 100644
--- a/src/ToolFactory.js
+++ b/src/ToolFactory.js
@@ -79,24 +79,26 @@
        var i, len, item, name, tool,
                names = [];
 
-       if ( collection === '*' ) {
-               for ( name in this.registry ) {
-                       tool = this.registry[ name ];
-                       if (
-                               // Only add tools by group name when auto-add 
is enabled
-                               tool.static.autoAddToCatchall &&
-                               // Exclude already used tools
-                               ( !used || !used[ name ] )
-                       ) {
-                               names.push( name );
-                               if ( used ) {
-                                       used[ name ] = true;
+       collection = !Array.isArray( collection ) ? [ collection ] : collection;
+
+       for ( i = 0, len = collection.length; i < len; i++ ) {
+               item = collection[ i ];
+               if ( item === '*' ) {
+                       for ( name in this.registry ) {
+                               tool = this.registry[ name ];
+                               if (
+                                       // Only add tools by group name when 
auto-add is enabled
+                                       tool.static.autoAddToCatchall &&
+                                       // Exclude already used tools
+                                       ( !used || !used[ name ] )
+                               ) {
+                                       names.push( name );
+                                       if ( used ) {
+                                               used[ name ] = true;
+                                       }
                                }
                        }
-               }
-       } else if ( Array.isArray( collection ) ) {
-               for ( i = 0, len = collection.length; i < len; i++ ) {
-                       item = collection[ i ];
+               } else {
                        // Allow plain strings as shorthand for named tools
                        if ( typeof item === 'string' ) {
                                item = { name: item };

-- 
To view, visit https://gerrit.wikimedia.org/r/298140
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1b161ffcb35241a5449b3c25b83adb959f807b14
Gerrit-PatchSet: 2
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to