fix home ping results when large number of network posts is present

This commit is contained in:
zotlabs 2018-12-09 14:15:35 -08:00
parent 3dcec558b6
commit cfaf1eaa76

View file

@ -345,6 +345,9 @@ class Ping extends \Zotlabs\Web\Controller {
if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) {
$result = array();
if(argv(1) === 'home') {
$sql_extra .= " and item_wall = 1 ";
}
$r = q("SELECT * FROM item
WHERE uid = %d
AND item_unseen = 1
@ -356,13 +359,11 @@ class Ping extends \Zotlabs\Web\Controller {
intval(local_channel()),
dbesc($ob_hash)
);
if($r) {
xchan_query($r);
foreach($r as $item) {
if((argv(1) === 'home') && (! intval($item['item_wall'])))
continue;
$z = \Zotlabs\Lib\Enotify::format($item);
if($z) {
$result[] = $z;
}
@ -543,13 +544,15 @@ class Ping extends \Zotlabs\Web\Controller {
call_hooks('network_ping', $arr);
foreach ($r as $it) {
if(intval($it['item_wall']))
if(intval($it['item_wall'])) {
$result['home'] ++;
else
}
else {
$result['network'] ++;
}
}
}
}
if(! ($vnotify & VNOTIFY_NETWORK))
$result['network'] = 0;
if(! ($vnotify & VNOTIFY_CHANNEL))