From 1f1d3b25788b8897b0ae9ea0db218178a9ed9c7d Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 2 Mar 2022 05:05:49 +0000 Subject: [PATCH] API: Only display active incoming contact requests --- .../Api/Twitter/Friendships/Incoming.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Module/Api/Twitter/Friendships/Incoming.php b/src/Module/Api/Twitter/Friendships/Incoming.php index 378159c3c2..d34d79fae0 100644 --- a/src/Module/Api/Twitter/Friendships/Incoming.php +++ b/src/Module/Api/Twitter/Friendships/Incoming.php @@ -46,32 +46,32 @@ class Incoming extends ContactEndpoint $max_id = $this->getRequestValue($request, 'max_id', 0, 0); $min_id = $this->getRequestValue($request, 'min_id', 0, 0); - $params = ['order' => ['cid' => true], 'limit' => $count]; + $params = ['order' => ['contact-id' => true], 'limit' => $count]; - $condition = ['uid' => $uid, 'pending' => true]; + $condition = ["`uid` = ? AND NOT `blocked` AND NOT `ignore` AND `contact-id` != 0 AND (`suggest-cid` = 0 OR `suggest-cid` IS NULL)", $uid]; - $total_count = (int)DBA::count('user-contact', $condition); + $total_count = (int)DBA::count('intro', $condition); if (!empty($max_id)) { - $condition = DBA::mergeConditions($condition, ["`cid` < ?", $max_id]); + $condition = DBA::mergeConditions($condition, ["`contact-id` < ?", $max_id]); } if (!empty($since_id)) { - $condition = DBA::mergeConditions($condition, ["`cid` > ?", $since_id]); + $condition = DBA::mergeConditions($condition, ["`contact-id` > ?", $since_id]); } if (!empty($min_id)) { - $condition = DBA::mergeConditions($condition, ["`cid` > ?", $min_id]); + $condition = DBA::mergeConditions($condition, ["`contact-id` > ?", $min_id]); - $params['order'] = ['cid']; + $params['order'] = ['contact-id']; } $ids = []; - $contacts = DBA::select('user-contact', ['cid'], $condition, $params); + $contacts = DBA::select('intro', ['contact-id'], $condition, $params); while ($contact = DBA::fetch($contacts)) { - self::setBoundaries($contact['cid']); - $ids[] = $contact['cid']; + self::setBoundaries($contact['contact-id']); + $ids[] = $contact['contact-id']; } DBA::close($contacts);