1
1
Fork 0

Issue 2772: Posts from pending contacts should be displayed as well.

This commit is contained in:
Michael 2016-11-20 16:52:57 +00:00
parent 1e40cdd1d4
commit 3de862712d
7 changed files with 24 additions and 24 deletions

View file

@ -623,7 +623,7 @@
// count friends // count friends
$r = q("SELECT count(*) as `count` FROM `contact` $r = q("SELECT count(*) as `count` FROM `contact`
WHERE `uid` = %d AND `rel` IN ( %d, %d ) WHERE `uid` = %d AND `rel` IN ( %d, %d )
AND `self`=0 AND `blocked`=0 AND `pending`=0 AND `hidden`=0", AND `self`=0 AND `blocked`=0 AND `hidden`=0",
intval($uinfo[0]['uid']), intval($uinfo[0]['uid']),
intval(CONTACT_IS_SHARING), intval(CONTACT_IS_SHARING),
intval(CONTACT_IS_FRIEND) intval(CONTACT_IS_FRIEND)
@ -632,7 +632,7 @@
$r = q("SELECT count(*) as `count` FROM `contact` $r = q("SELECT count(*) as `count` FROM `contact`
WHERE `uid` = %d AND `rel` IN ( %d, %d ) WHERE `uid` = %d AND `rel` IN ( %d, %d )
AND `self`=0 AND `blocked`=0 AND `pending`=0 AND `hidden`=0", AND `self`=0 AND `blocked`=0 AND `hidden`=0",
intval($uinfo[0]['uid']), intval($uinfo[0]['uid']),
intval(CONTACT_IS_FOLLOWER), intval(CONTACT_IS_FOLLOWER),
intval(CONTACT_IS_FRIEND) intval(CONTACT_IS_FRIEND)
@ -1399,7 +1399,7 @@
`contact`.`id` AS `cid` `contact`.`id` AS `cid`
FROM `item` FROM `item`
STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid` STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid`
AND NOT `contact`.`blocked` AND NOT `contact`.`pending` AND NOT `contact`.`blocked`
WHERE `item`.`uid` = %d AND `verb` = '%s' WHERE `item`.`uid` = %d AND `verb` = '%s'
AND `item`.`visible` AND NOT `item`.`moderated` AND NOT `item`.`deleted` AND `item`.`visible` AND NOT `item`.`moderated` AND NOT `item`.`deleted`
$sql_extra $sql_extra
@ -1476,7 +1476,7 @@
`user`.`nickname`, `user`.`hidewall` `user`.`nickname`, `user`.`hidewall`
FROM `item` FROM `item`
STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid` STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid`
AND NOT `contact`.`blocked` AND NOT `contact`.`pending` AND NOT `contact`.`blocked`
STRAIGHT_JOIN `user` ON `user`.`uid` = `item`.`uid` STRAIGHT_JOIN `user` ON `user`.`uid` = `item`.`uid`
AND NOT `user`.`hidewall` AND NOT `user`.`hidewall`
WHERE `verb` = '%s' AND `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated` WHERE `verb` = '%s' AND `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
@ -1543,7 +1543,7 @@
`contact`.`id` AS `cid` `contact`.`id` AS `cid`
FROM `item` FROM `item`
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid`
AND NOT `contact`.`blocked` AND NOT `contact`.`pending` AND NOT `contact`.`blocked`
WHERE `item`.`visible` AND NOT `item`.`moderated` AND NOT `item`.`deleted` WHERE `item`.`visible` AND NOT `item`.`moderated` AND NOT `item`.`deleted`
AND `item`.`uid` = %d AND `item`.`verb` = '%s' AND `item`.`uid` = %d AND `item`.`verb` = '%s'
$sql_extra", $sql_extra",
@ -1619,7 +1619,7 @@
`contact`.`id` AS `cid` `contact`.`id` AS `cid`
FROM `item` FROM `item`
STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid` STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid`
AND NOT `contact`.`blocked` AND NOT `contact`.`pending` AND NOT `contact`.`blocked`
WHERE `item`.`parent` = %d AND `item`.`visible` WHERE `item`.`parent` = %d AND `item`.`visible`
AND NOT `item`.`moderated` AND NOT `item`.`deleted` AND NOT `item`.`moderated` AND NOT `item`.`deleted`
AND `item`.`uid` = %d AND `item`.`verb` = '%s' AND `item`.`uid` = %d AND `item`.`verb` = '%s'
@ -1673,7 +1673,7 @@
`contact`.`id` AS `cid` `contact`.`id` AS `cid`
FROM `item` FROM `item`
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid`
AND NOT `contact`.`blocked` AND NOT `contact`.`pending` AND NOT `contact`.`blocked`
WHERE `item`.`visible` AND NOT `item`.`moderated` AND NOT `item`.`deleted` WHERE `item`.`visible` AND NOT `item`.`moderated` AND NOT `item`.`deleted`
AND NOT `item`.`private` AND `item`.`allow_cid` = '' AND `item`.`allow`.`gid` = '' AND NOT `item`.`private` AND `item`.`allow_cid` = '' AND `item`.`allow`.`gid` = ''
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
@ -1792,7 +1792,7 @@
`contact`.`id` AS `cid` `contact`.`id` AS `cid`
FROM `item` FORCE INDEX (`uid_id`) FROM `item` FORCE INDEX (`uid_id`)
STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid` STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid`
AND NOT `contact`.`blocked` AND NOT `contact`.`pending` AND NOT `contact`.`blocked`
WHERE `item`.`uid` = %d AND `verb` = '%s' WHERE `item`.`uid` = %d AND `verb` = '%s'
AND NOT (`item`.`author-link` IN ('https://%s', 'http://%s')) AND NOT (`item`.`author-link` IN ('https://%s', 'http://%s'))
AND `item`.`visible` AND NOT `item`.`moderated` AND NOT `item`.`deleted` AND `item`.`visible` AND NOT `item`.`moderated` AND NOT `item`.`deleted`
@ -1866,7 +1866,7 @@
`contact`.`id` AS `cid` `contact`.`id` AS `cid`
FROM `item` FORCE INDEX (`uid_contactid_id`) FROM `item` FORCE INDEX (`uid_contactid_id`)
STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid` STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid`
AND NOT `contact`.`blocked` AND NOT `contact`.`pending` AND NOT `contact`.`blocked`
WHERE `item`.`uid` = %d AND `verb` = '%s' WHERE `item`.`uid` = %d AND `verb` = '%s'
AND `item`.`contact-id` = %d AND `item`.`contact-id` = %d
AND `item`.`visible` AND NOT `item`.`moderated` AND NOT `item`.`deleted` AND `item`.`visible` AND NOT `item`.`moderated` AND NOT `item`.`deleted`
@ -2002,7 +2002,7 @@
AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
AND `item`.`starred` = 1 AND `item`.`starred` = 1
AND `contact`.`id` = `item`.`contact-id` AND `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND NOT `contact`.`blocked`
$sql_extra $sql_extra
AND `item`.`id`>%d AND `item`.`id`>%d
ORDER BY `item`.`id` DESC LIMIT %d ,%d ", ORDER BY `item`.`id` DESC LIMIT %d ,%d ",
@ -2648,7 +2648,7 @@
if ($user_info['self'] == 0) if ($user_info['self'] == 0)
$sql_extra = " AND false "; $sql_extra = " AND false ";
$r = q("SELECT `nurl` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 $sql_extra", $r = q("SELECT `nurl` FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `blocked` $sql_extra",
intval(api_user()) intval(api_user())
); );

View file

@ -439,7 +439,7 @@ These Fields are not added below (yet). They are here to for bug search.
function item_joins() { function item_joins() {
return "STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND return "STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND
NOT `contact`.`blocked` AND NOT `contact`.`pending` NOT `contact`.`blocked`
LEFT JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id` LEFT JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id`
LEFT JOIN `contact` AS `owner` ON `owner`.`id`=`item`.`owner-id`"; LEFT JOIN `contact` AS `owner` ON `owner`.`id`=`item`.`owner-id`";
} }
@ -885,7 +885,7 @@ function best_link_url($item,&$sparkle,$ssl_state = false) {
$clean_url = normalise_link($item['author-link']); $clean_url = normalise_link($item['author-link']);
if (local_user()) { if (local_user()) {
$r = q("SELECT `id` FROM `contact` WHERE `network` = '%s' AND `uid` = %d AND `nurl` = '%s' AND NOT `pending` LIMIT 1", $r = q("SELECT `id` FROM `contact` WHERE `network` = '%s' AND `uid` = %d AND `nurl` = '%s' LIMIT 1",
dbesc(NETWORK_DFRN), intval(local_user()), dbesc(normalise_link($clean_url))); dbesc(NETWORK_DFRN), intval(local_user()), dbesc(normalise_link($clean_url)));
if ($r) { if ($r) {
$best_url = 'redir/'.$r[0]['id']; $best_url = 'redir/'.$r[0]['id'];

View file

@ -134,7 +134,7 @@ class dfrn {
break; // NOTREACHED break; // NOTREACHED
} }
$r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `contact`.`uid` = %d $sql_extra LIMIT 1", $r = q("SELECT * FROM `contact` WHERE NOT `blocked` AND `contact`.`uid` = %d $sql_extra LIMIT 1",
intval($owner_id) intval($owner_id)
); );

View file

@ -371,7 +371,7 @@ function profile_sidebar($profile, $block = 0) {
if(count($r)) if(count($r))
$updated = date("c", strtotime($r[0]['updated'])); $updated = date("c", strtotime($r[0]['updated']));
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `hidden` AND NOT `archive`
AND `network` IN ('%s', '%s', '%s', '')", AND `network` IN ('%s', '%s', '%s', '')",
intval($profile['uid']), intval($profile['uid']),
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),

View file

@ -874,8 +874,8 @@ function contact_block() {
if((! is_array($a->profile)) || ($a->profile['hide-friends'])) if((! is_array($a->profile)) || ($a->profile['hide-friends']))
return $o; return $o;
$r = q("SELECT COUNT(*) AS `total` FROM `contact` $r = q("SELECT COUNT(*) AS `total` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 WHERE `uid` = %d AND NOT `self` AND NOT `blocked`
AND `hidden` = 0 AND `archive` = 0 AND NOT `hidden` AND NOT `archive`
AND `network` IN ('%s', '%s', '%s')", AND `network` IN ('%s', '%s', '%s')",
intval($a->profile['uid']), intval($a->profile['uid']),
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),
@ -892,7 +892,7 @@ function contact_block() {
} else { } else {
// Splitting the query in two parts makes it much faster // Splitting the query in two parts makes it much faster
$r = q("SELECT `id` FROM `contact` $r = q("SELECT `id` FROM `contact`
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` WHERE `uid` = %d AND NOT `self` AND NOT `blocked`
AND NOT `hidden` AND NOT `archive` AND NOT `hidden` AND NOT `archive`
AND `network` IN ('%s', '%s', '%s') ORDER BY RAND() LIMIT %d", AND `network` IN ('%s', '%s', '%s') ORDER BY RAND() LIMIT %d",
intval($a->profile['uid']), intval($a->profile['uid']),

View file

@ -504,7 +504,7 @@ function network_content(&$a, $update = 0) {
elseif($cid) { elseif($cid) {
$r = qu("SELECT `id`,`name`,`network`,`writable`,`nurl`, `forum`, `prv`, `contact-type`, `addr`, `thumb`, `location` FROM `contact` WHERE `id` = %d $r = qu("SELECT `id`,`name`,`network`,`writable`,`nurl`, `forum`, `prv`, `contact-type`, `addr`, `thumb`, `location` FROM `contact` WHERE `id` = %d
AND `blocked` = 0 AND `pending` = 0 LIMIT 1", AND NOT `blocked` LIMIT 1",
intval($cid) intval($cid)
); );
if(count($r)) { if(count($r)) {
@ -603,7 +603,7 @@ function network_content(&$a, $update = 0) {
if(get_config('system', 'old_pager')) { if(get_config('system', 'old_pager')) {
$r = qu("SELECT COUNT(*) AS `total` $r = qu("SELECT COUNT(*) AS `total`
FROM $sql_table $sql_post_table INNER JOIN `contact` ON `contact`.`id` = $sql_table.`contact-id` FROM $sql_table $sql_post_table INNER JOIN `contact` ON `contact`.`id` = $sql_table.`contact-id`
AND NOT `contact`.`blocked` AND NOT `contact`.`pending` AND NOT `contact`.`blocked`
WHERE $sql_table.`uid` = %d AND $sql_table.`visible` AND NOT $sql_table.`deleted` WHERE $sql_table.`uid` = %d AND $sql_table.`visible` AND NOT $sql_table.`deleted`
$sql_extra2 $sql_extra3 $sql_extra2 $sql_extra3
$sql_extra $sql_nets ", $sql_extra $sql_nets ",
@ -681,7 +681,7 @@ function network_content(&$a, $update = 0) {
$r = qu("SELECT `item`.`parent` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid` $r = qu("SELECT `item`.`parent` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid`
FROM $sql_table $sql_post_table INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` FROM $sql_table $sql_post_table INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
AND NOT `contact`.`blocked` AND NOT `contact`.`pending` AND NOT `contact`.`blocked`
WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted` $sql_extra4 WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted` $sql_extra4
AND NOT `item`.`moderated` AND `item`.`unseen` AND NOT `item`.`moderated` AND `item`.`unseen`
$sql_extra3 $sql_extra $sql_nets $sql_extra3 $sql_extra $sql_nets
@ -691,7 +691,7 @@ function network_content(&$a, $update = 0) {
} else { } else {
$r = qu("SELECT `thread`.`iid` AS `item_id`, `thread`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid` $r = qu("SELECT `thread`.`iid` AS `item_id`, `thread`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid`
FROM $sql_table $sql_post_table STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id` FROM $sql_table $sql_post_table STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
AND NOT `contact`.`blocked` AND NOT `contact`.`pending` AND NOT `contact`.`blocked`
WHERE `thread`.`uid` = %d AND `thread`.`visible` AND NOT `thread`.`deleted` WHERE `thread`.`uid` = %d AND `thread`.`visible` AND NOT `thread`.`deleted`
AND NOT `thread`.`moderated` AND NOT `thread`.`moderated`
$sql_extra2 $sql_extra3 $sql_extra $sql_nets $sql_extra2 $sql_extra3 $sql_extra $sql_nets

View file

@ -47,7 +47,7 @@ function viewcontacts_content(&$a) {
} }
$r = q("SELECT COUNT(*) AS `total` FROM `contact` $r = q("SELECT COUNT(*) AS `total` FROM `contact`
WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 WHERE `uid` = %d AND NOT `blocked` AND NOT `hidden` AND NOT `archive`
AND `network` IN ('%s', '%s', '%s')", AND `network` IN ('%s', '%s', '%s')",
intval($a->profile['uid']), intval($a->profile['uid']),
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),
@ -58,7 +58,7 @@ function viewcontacts_content(&$a) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
$r = q("SELECT * FROM `contact` $r = q("SELECT * FROM `contact`
WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 WHERE `uid` = %d AND NOT `blocked` AND NOT `hidden` AND NOT `archive`
AND `network` IN ('%s', '%s', '%s') AND `network` IN ('%s', '%s', '%s')
ORDER BY `name` ASC LIMIT %d, %d", ORDER BY `name` ASC LIMIT %d, %d",
intval($a->profile['uid']), intval($a->profile['uid']),