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