X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryUserInfo.php;h=0fc443ab21f306f721e2f7509f701ed765e8fbf4;hb=b7221eaa0893e9e1ed31355e3ea98773fbc628ba;hp=9e7e62e7be2daa4b918dc9f7fc722647c668a46b;hpb=40a628a501fc05bb00e834fe359ca4061925f320;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index 9e7e62e7be..0fc443ab21 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -225,23 +225,15 @@ class ApiQueryUserInfo extends ApiQueryBase { } if ( isset( $this->prop['unreadcount'] ) ) { - $dbr = $this->getQuery()->getNamedDB( 'watchlist', DB_SLAVE, 'watchlist' ); - - $count = $dbr->selectRowCount( - 'watchlist', - '1', - [ - 'wl_user' => $user->getId(), - 'wl_notificationtimestamp IS NOT NULL', - ], - __METHOD__, - [ 'LIMIT' => self::WL_UNREAD_LIMIT ] + $unreadNotifications = WatchedItemStore::getDefaultInstance()->countUnreadNotifications( + $user, + self::WL_UNREAD_LIMIT ); - if ( $count >= self::WL_UNREAD_LIMIT ) { + if ( $unreadNotifications === true ) { $vals['unreadcount'] = self::WL_UNREAD_LIMIT . '+'; } else { - $vals['unreadcount'] = $count; + $vals['unreadcount'] = $unreadNotifications; } }