From 3474b407322092ebedb8ffb7a45afdbee0c486d0 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 10 Feb 2017 03:51:01 +0100 Subject: [PATCH] fix - pending contacts shouldn't be shown in contacts widgit and viewcontacts --- include/api.php | 4 ++-- include/identity.php | 5 ++++- include/text.php | 7 ++++--- mod/viewcontacts.php | 6 ++++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/api.php b/include/api.php index ce76103129..d7fa1d5875 100644 --- a/include/api.php +++ b/include/api.php @@ -626,7 +626,7 @@ use \Friendica\Core\Config; // count friends $r = q("SELECT count(*) as `count` FROM `contact` WHERE `uid` = %d AND `rel` IN ( %d, %d ) - AND `self`=0 AND NOT `blocked` AND `hidden`=0", + AND `self`=0 AND NOT `blocked` AND NOT `pending` AND `hidden`=0", intval($uinfo[0]['uid']), intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND) @@ -635,7 +635,7 @@ use \Friendica\Core\Config; $r = q("SELECT count(*) as `count` FROM `contact` WHERE `uid` = %d AND `rel` IN ( %d, %d ) - AND `self`=0 AND NOT `blocked` AND `hidden`=0", + AND `self`=0 AND NOT `blocked` AND NOT `pending` AND `hidden`=0", intval($uinfo[0]['uid']), intval(CONTACT_IS_FOLLOWER), intval(CONTACT_IS_FRIEND) diff --git a/include/identity.php b/include/identity.php index d3852b2c2c..ab80c71cea 100644 --- a/include/identity.php +++ b/include/identity.php @@ -374,7 +374,10 @@ function profile_sidebar($profile, $block = 0) { if (dbm::is_result($r)) $updated = date("c", strtotime($r[0]['updated'])); - $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `hidden` AND NOT `archive` + $r = q("SELECT COUNT(*) AS `total` FROM `contact` + WHERE `uid` = %d + AND NOT `self` AND NOT `blocked` AND NOT `pending` + AND NOT `hidden` AND NOT `archive` AND `network` IN ('%s', '%s', '%s', '')", intval($profile['uid']), dbesc(NETWORK_DFRN), diff --git a/include/text.php b/include/text.php index f77a4dec2c..11248902ba 100644 --- a/include/text.php +++ b/include/text.php @@ -875,7 +875,7 @@ function contact_block() { return $o; $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `blocked` - AND NOT `hidden` AND NOT `archive` + AND NOT `pending` AND NOT `hidden` AND NOT `archive` AND `network` IN ('%s', '%s', '%s')", intval($a->profile['uid']), dbesc(NETWORK_DFRN), @@ -893,8 +893,9 @@ function contact_block() { // Splitting the query in two parts makes it much faster $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `blocked` - AND NOT `hidden` AND NOT `archive` - AND `network` IN ('%s', '%s', '%s') ORDER BY RAND() LIMIT %d", + AND NOT `pending` AND NOT `hidden` AND NOT `archive` + AND `network` IN ('%s', '%s', '%s') + ORDER BY RAND() LIMIT %d", intval($a->profile['uid']), dbesc(NETWORK_DFRN), dbesc(NETWORK_OSTATUS), diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index 55afda9b63..5912f6cc77 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -48,7 +48,8 @@ function viewcontacts_content(App $a) { } $r = q("SELECT COUNT(*) AS `total` FROM `contact` - WHERE `uid` = %d AND (NOT `blocked` OR `pending`) AND NOT `hidden` AND NOT `archive` + WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` + AND NOT `hidden` AND NOT `archive` AND `network` IN ('%s', '%s', '%s')", intval($a->profile['uid']), dbesc(NETWORK_DFRN), @@ -59,7 +60,8 @@ function viewcontacts_content(App $a) { $a->set_pager_total($r[0]['total']); $r = q("SELECT * FROM `contact` - WHERE `uid` = %d AND (NOT `blocked` OR `pending`) AND NOT `hidden` AND NOT `archive` + WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` + AND NOT `hidden` AND NOT `archive` AND `network` IN ('%s', '%s', '%s') ORDER BY `name` ASC LIMIT %d, %d", intval($a->profile['uid']), -- 2.39.5