Harej has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/333478 )
Change subject: Accounting for member lists with zero items ...................................................................... Accounting for member lists with zero items Bug: T155871 Change-Id: Ia7ab5739aef18ec830eae192325b884a03b5d5b4 --- M includes/content/CollaborationListContent.php 1 file changed, 22 insertions(+), 18 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CollaborationKit refs/changes/78/333478/1 diff --git a/includes/content/CollaborationListContent.php b/includes/content/CollaborationListContent.php index bb9103b..5f6e7fc 100644 --- a/includes/content/CollaborationListContent.php +++ b/includes/content/CollaborationListContent.php @@ -960,26 +960,30 @@ * @return Array [ 'active' => [..], 'inactive' => '[..]' ] */ private function filterActiveUsers( $userList ) { - $users = array_keys( $userList ); - $dbr = wfGetDB( DB_REPLICA ); - $res = $dbr->select( - 'querycachetwo', - 'qcc_title', - [ - 'qcc_namespace' => NS_USER, - // TODO: Perhaps should use batching. - 'qcc_title' => $users, - 'qcc_type' => 'activeusers' - ], - __METHOD__ - ); + if ( count( $userList ) > 0 ) { + $users = array_keys( $userList ); + $dbr = wfGetDB( DB_REPLICA ); + $res = $dbr->select( + 'querycachetwo', + 'qcc_title', + [ + 'qcc_namespace' => NS_USER, + // TODO: Perhaps should use batching. + 'qcc_title' => $users, + 'qcc_type' => 'activeusers' + ], + __METHOD__ + ); - $active = []; - foreach ( $res as $row ) { - $active[$row->qcc_title] = $userList[$row->qcc_title]; - unset( $userList[$row->qcc_title] ); + $active = []; + foreach ( $res as $row ) { + $active[$row->qcc_title] = $userList[$row->qcc_title]; + unset( $userList[$row->qcc_title] ); + } + return [ 'active' => $active, 'inactive' => $userList ]; + } else { + return [ 'active' => [], 'inactive' => [] ]; } - return [ 'active' => $active, 'inactive' => $userList ]; } /** -- To view, visit https://gerrit.wikimedia.org/r/333478 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia7ab5739aef18ec830eae192325b884a03b5d5b4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CollaborationKit Gerrit-Branch: master Gerrit-Owner: Harej <jamesmh...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits