Merge "Add ability to define packageFiles in extension.json"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 11 Feb 2019 18:27:04 +0000 (18:27 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 11 Feb 2019 18:27:04 +0000 (18:27 +0000)
includes/linkeddata/PageDataRequestHandler.php
includes/watcheditem/WatchedItemQueryService.php
resources/src/jquery.tablesorter/jquery.tablesorter.js
resources/src/mediawiki.rcfilters/dm/FiltersViewModel.js
resources/src/mediawiki.widgets/mw.widgets.TitleSearchWidget.js

index d70688f..61efba0 100644 (file)
@@ -40,7 +40,6 @@ class PageDataRequestHandler {
         * @param WebRequest $request
         *
         * @return bool
-        * @throws HttpError
         */
        public function canHandleRequest( $subPage, WebRequest $request ) {
                if ( $subPage === '' || $subPage === null ) {
index 95b4cb4..a85e7e8 100644 (file)
@@ -88,7 +88,6 @@ class WatchedItemQueryService {
 
        /**
         * @return IDatabase
-        * @throws MWException
         */
        private function getConnection() {
                return $this->loadBalancer->getConnectionRef( DB_REPLICA, [ 'watchlist' ] );
index 4882e9e..57fd3ab 100644 (file)
                headerToColumns.forEach( function ( columns, headerIndex ) {
 
                        columns.forEach( function ( columnIndex, i ) {
-                               var header = $headers[ headerIndex ],
+                               var j, sortColumn,
+                                       header = $headers[ headerIndex ],
                                        $header = $( header );
 
                                if ( !isValueInArray( columnIndex, sortList ) ) {
                                        } );
                                } else {
                                        // Column shall be sorted: Apply designated count and order.
-                                       sortList.forEach( function ( sortColumn ) {
+                                       for ( j = 0; j < sortList.length; j++ ) {
+                                               sortColumn = sortList[ j ];
                                                if ( sortColumn[ 0 ] === i ) {
                                                        $header.data( {
                                                                order: sortColumn[ 1 ],
                                                                count: sortColumn[ 1 ] + 1
                                                        } );
-                                                       return false;
+                                                       break;
                                                }
-                                       } );
+                                       }
                                }
                        } );
 
index d89bb28..2e6abab 100644 (file)
        /**
         * Get the first item with a current conflict
         *
-        * @return {mw.rcfilters.dm.FilterItem} Conflicted item
+        * @return {mw.rcfilters.dm.FilterItem|undefined} Conflicted item or undefined when not found
         */
        FiltersViewModel.prototype.getFirstConflictedItem = function () {
-               var conflictedItem;
-
-               this.getItems().forEach( function ( filterItem ) {
+               var i, filterItem, items = this.getItems();
+               for ( i = 0; i < items.length; i++ ) {
+                       filterItem = items[ i ];
                        if ( filterItem.isSelected() && filterItem.isConflicted() ) {
-                               conflictedItem = filterItem;
-                               return false;
+                               return filterItem;
                        }
-               } );
-
-               return conflictedItem;
+               }
        };
 
        /**
index b9bd1e0..f1f98a2 100644 (file)
                var widget = this;
 
                this.getRequestData().done( function ( data ) {
+                       if ( widget.query.isReadOnly() ) {
+                               // The request object is always abortable, so just
+                               // prevent the results from displaying
+                               return;
+                       }
                        // Parent method
                        mw.widgets.TitleSearchWidget.parent.prototype.onQueryChange.call( widget );
                        widget.results.addItems( widget.getOptionsFromData( data ) );
                return response.query || {};
        };
 
+       /**
+        * Check if the widget is read-only.
+        *
+        * @return {boolean}
+        */
+       mw.widgets.TitleSearchWidget.prototype.isReadOnly = function () {
+               return this.query.isReadOnly();
+       };
+
+       /**
+        * Set the read-only state of the widget.
+        *
+        * @param {boolean} readOnly Make input read-only
+        * @chainable
+        * @return {mw.widgets.TitleSearchWidget} The widget, for chaining
+        */
+       mw.widgets.TitleSearchWidget.prototype.setReadOnly = function ( readOnly ) {
+               this.query.setReadOnly( readOnly );
+               if ( readOnly ) {
+                       // Hide results
+                       this.results.clearItems();
+               }
+               return this;
+       };
+
 }() );