Merge pull request #7939 from annando/issue-7659
Issue 7659: Display blocked and ignored public contacts as well
This commit is contained in:
commit
ff3a0a0eba
1 changed files with 13 additions and 9 deletions
|
@ -646,21 +646,25 @@ class Contact extends BaseModule
|
||||||
return $arr['output'];
|
return $arr['output'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$select_uid = local_user();
|
||||||
|
|
||||||
// @TODO: Replace with parameter from router
|
// @TODO: Replace with parameter from router
|
||||||
$type = $a->argv[1] ?? '';
|
$type = $a->argv[1] ?? '';
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'blocked':
|
case 'blocked':
|
||||||
$sql_extra = " AND `blocked`";
|
$sql_extra = sprintf(" AND EXISTS(SELECT `id` from `user-contact` WHERE `contact`.`id` = `user-contact`.`cid` and `user-contact`.`uid` = %d and `user-contact`.`blocked`)", intval(local_user()));
|
||||||
|
$select_uid = 0;
|
||||||
break;
|
break;
|
||||||
case 'hidden':
|
case 'hidden':
|
||||||
$sql_extra = " AND `hidden` AND NOT `blocked`";
|
$sql_extra = " AND `hidden` AND NOT `blocked` AND NOT `pending`";
|
||||||
break;
|
break;
|
||||||
case 'ignored':
|
case 'ignored':
|
||||||
$sql_extra = " AND `readonly` AND NOT `blocked`";
|
$sql_extra = sprintf(" AND EXISTS(SELECT `id` from `user-contact` WHERE `contact`.`id` = `user-contact`.`cid` and `user-contact`.`uid` = %d and `user-contact`.`ignored`)", intval(local_user()));
|
||||||
|
$select_uid = 0;
|
||||||
break;
|
break;
|
||||||
case 'archived':
|
case 'archived':
|
||||||
$sql_extra = " AND `archive` AND NOT `blocked`";
|
$sql_extra = " AND `archive` AND NOT `blocked` AND NOT `pending`";
|
||||||
break;
|
break;
|
||||||
case 'pending':
|
case 'pending':
|
||||||
$sql_extra = sprintf(" AND `pending` AND NOT `archive` AND ((`rel` = %d)
|
$sql_extra = sprintf(" AND `pending` AND NOT `archive` AND ((`rel` = %d)
|
||||||
|
@ -762,21 +766,21 @@ class Contact extends BaseModule
|
||||||
|
|
||||||
$sql_extra2 = ((($sort_type > 0) && ($sort_type <= Model\Contact::FRIEND)) ? sprintf(" AND `rel` = %d ", intval($sort_type)) : '');
|
$sql_extra2 = ((($sort_type > 0) && ($sort_type <= Model\Contact::FRIEND)) ? sprintf(" AND `rel` = %d ", intval($sort_type)) : '');
|
||||||
|
|
||||||
|
$sql_extra3 = Widget::unavailableNetworks();
|
||||||
|
|
||||||
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
|
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
|
||||||
WHERE `uid` = %d AND `self` = 0 $sql_extra $sql_extra2 ",
|
WHERE `uid` = %d AND `self` = 0 $sql_extra $sql_extra2 $sql_extra3",
|
||||||
intval($_SESSION['uid'])
|
intval($select_uid)
|
||||||
);
|
);
|
||||||
if (DBA::isResult($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$total = $r[0]['total'];
|
$total = $r[0]['total'];
|
||||||
}
|
}
|
||||||
$pager = new Pager($a->query_string);
|
$pager = new Pager($a->query_string);
|
||||||
|
|
||||||
$sql_extra3 = Widget::unavailableNetworks();
|
|
||||||
|
|
||||||
$contacts = [];
|
$contacts = [];
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 $sql_extra $sql_extra2 $sql_extra3 ORDER BY `name` ASC LIMIT %d , %d ",
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 $sql_extra $sql_extra2 $sql_extra3 ORDER BY `name` ASC LIMIT %d , %d ",
|
||||||
intval($_SESSION['uid']),
|
intval($select_uid),
|
||||||
$pager->getStart(),
|
$pager->getStart(),
|
||||||
$pager->getItemsPerPage()
|
$pager->getItemsPerPage()
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue