jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373364 )

Change subject: Hygiene: Drop usages of inArray
......................................................................


Hygiene: Drop usages of inArray

We can guarantee ES5 support so we can guarantee indexOf
availability

Bug: T173981
Change-Id: I663a7a74032822de21fa202ccaf15afff17c8e71
---
M resources/mobile.categories.overlays/CategoryLookupInputWidget.js
M resources/mobile.editor.overlay/EditorOverlay.js
M resources/mobile.search.util/extendSearchParams.js
M resources/mobile.startup/time.js
M resources/mobile.talk.overlays/TalkSectionOverlay.js
M tests/qunit/mobile.search.util/test_extendSearchParams.js
6 files changed, 16 insertions(+), 12 deletions(-)

Approvals:
  Jhernandez: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/mobile.categories.overlays/CategoryLookupInputWidget.js 
b/resources/mobile.categories.overlays/CategoryLookupInputWidget.js
index 97c3d18..f120844 100644
--- a/resources/mobile.categories.overlays/CategoryLookupInputWidget.js
+++ b/resources/mobile.categories.overlays/CategoryLookupInputWidget.js
@@ -13,7 +13,7 @@
                this.$element = $( '<div>' );
                this.gateway = options.gateway;
                this.$suggestions = options.suggestions;
-               this.categories = options.categories;
+               this.categories = options.categories || [];
                this.$saveButton = options.saveButton;
                options.placeholder = mw.msg( 
'mobile-frontend-categories-search' );
                OO.ui.TextInputWidget.call( this, options );
@@ -77,7 +77,7 @@
                data.results.forEach( function ( value ) {
                        if (
                                !$el.find( 'div[data-title="' + value.title + 
'"]' ).length &&
-                               $.inArray( value.displayTitle, self.categories 
) === -1
+                               self.categories.indexOf( value.displayTitle ) 
=== -1
                        ) {
                                result.push(
                                        new OO.ui.MenuOptionWidget( {
diff --git a/resources/mobile.editor.overlay/EditorOverlay.js 
b/resources/mobile.editor.overlay/EditorOverlay.js
index ad106d1..1024a08 100644
--- a/resources/mobile.editor.overlay/EditorOverlay.js
+++ b/resources/mobile.editor.overlay/EditorOverlay.js
@@ -95,8 +95,13 @@
                 * @return {boolean}
                 */
                isVisualEditorEnabled: function () {
-                       return mw.config.get( 'wgVisualEditorConfig' ) &&
-                               $.inArray( mw.config.get( 'wgNamespaceNumber' 
), mw.config.get( 'wgVisualEditorConfig' ).namespaces ) > -1 &&
+                       var ns = mw.config.get( 'wgVisualEditorConfig' ) &&
+                               mw.config.get( 'wgVisualEditorConfig' 
).namespaces;
+
+                       return ns &&
+                               ns.indexOf(
+                                       mw.config.get( 'wgNamespaceNumber' )
+                               ) > -1 &&
                                mw.config.get( 'wgTranslatePageTranslation' ) 
!== 'translation' &&
                                mw.config.get( 'wgPageContentModel' ) === 
'wikitext';
                },
@@ -492,7 +497,7 @@
                                        } else {
                                                if ( key === 'editconflict' ) {
                                                        msg = mw.msg( 
'mobile-frontend-editor-error-conflict' );
-                                               } else if ( $.inArray( key, 
whitelistedErrorInfo ) > -1 ) {
+                                               } else if ( 
whitelistedErrorInfo.indexOf( key ) > -1 ) {
                                                        msg = 
response.error.info;
                                                } else {
                                                        msg = mw.msg( 
'mobile-frontend-editor-error' );
diff --git a/resources/mobile.search.util/extendSearchParams.js 
b/resources/mobile.search.util/extendSearchParams.js
index 2fede9f..7650e01 100644
--- a/resources/mobile.search.util/extendSearchParams.js
+++ b/resources/mobile.search.util/extendSearchParams.js
@@ -50,7 +50,7 @@
                result.prop = result.prop.concat( mw.config.get( 
'wgMFQueryPropModules' ) );
 
                if ( displayWikibaseDescriptions[feature] ) {
-                       if ( $.inArray( 'pageterms', result.prop ) === -1 ) {
+                       if ( result.prop.indexOf( 'pageterms' ) === -1 ) {
                                result.prop.push( 'pageterms' );
                        }
 
diff --git a/resources/mobile.startup/time.js b/resources/mobile.startup/time.js
index 54d87d7..841cb13 100644
--- a/resources/mobile.startup/time.js
+++ b/resources/mobile.startup/time.js
@@ -38,8 +38,7 @@
         * @ignore
         */
        function isRecent( delta ) {
-               var u = delta.unit;
-               return $.inArray( u, [ 'seconds', 'minutes', 'hours' ] ) > -1;
+               return [ 'seconds', 'minutes', 'hours' ].indexOf( delta.unit ) 
> -1;
        }
 
        /**
diff --git a/resources/mobile.talk.overlays/TalkSectionOverlay.js 
b/resources/mobile.talk.overlays/TalkSectionOverlay.js
index aa358c6..a8af395 100644
--- a/resources/mobile.talk.overlays/TalkSectionOverlay.js
+++ b/resources/mobile.talk.overlays/TalkSectionOverlay.js
@@ -134,7 +134,7 @@
 
                                        if (
                                                response.error &&
-                                               $.inArray( response.error.code, 
whitelistedErrorInfo ) > -1
+                                               whitelistedErrorInfo.indexOf( 
response.error.code ) > -1
                                        ) {
                                                msg = response.error.info;
                                        } else {
diff --git a/tests/qunit/mobile.search.util/test_extendSearchParams.js 
b/tests/qunit/mobile.search.util/test_extendSearchParams.js
index f312c22..e43fae0 100644
--- a/tests/qunit/mobile.search.util/test_extendSearchParams.js
+++ b/tests/qunit/mobile.search.util/test_extendSearchParams.js
@@ -1,4 +1,4 @@
-( function ( M, $ ) {
+( function ( M ) {
 
        var extendSearchParams = M.require( 
'mobile.search.util/extendSearchParams' );
 
@@ -49,7 +49,7 @@
 
                QUnit.expect( 2 );
 
-               assert.equal( $.inArray( params.prop, 'pageterms' ), -1 );
+               assert.equal( params.prop.indexOf( 'pageterms' ), -1 );
                assert.equal( params.wbptterms, undefined );
        } );
 
@@ -109,4 +109,4 @@
                assert.deepEqual( params, expectedParams );
        } );
 
-}( mw.mobileFrontend, jQuery ) );
+}( mw.mobileFrontend ) );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I663a7a74032822de21fa202ccaf15afff17c8e71
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jhernandez <[email protected]>
Gerrit-Reviewer: Pmiazga <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to