From 0fba1bb868254c3731d03d9bf5d1b19a8b71b265 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 18 Jan 2018 14:11:15 -0800 Subject: simplify interactions with the get_features hook by calling it before any filtering takes place --- Zotlabs/Widget/Forums.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'Zotlabs/Widget/Forums.php') diff --git a/Zotlabs/Widget/Forums.php b/Zotlabs/Widget/Forums.php index 0b90b9740..44d95012f 100644 --- a/Zotlabs/Widget/Forums.php +++ b/Zotlabs/Widget/Forums.php @@ -71,6 +71,8 @@ class Forums { if($r) $r1[$x]['unseen'] = $r[0]['unseen']; + } + /** * @FIXME * This SQL makes the counts correct when you get forum posts arriving from different routes/sources @@ -79,21 +81,19 @@ class Forums { * It may make more sense in that query to look for the mention in the body rather than another join, * but that makes it very inefficient. * - $r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ", - intval(TERM_OBJ_POST), - dbesc($r1[$x]['xchan_hash']), - intval(local_channel()), - dbesc($r1[$x]['xchan_url']), - intval(TERM_MENTION) - ); - if($r) - $r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']); + * $r = q("select sum(item_unseen) as unseen from item left join term on oid = id where otype = %d and owner_xchan != '%s' and item.uid = %d and url = '%s' and ttype = %d $perms_sql ", + * intval(TERM_OBJ_POST), + * dbesc($r1[$x]['xchan_hash']), + * intval(local_channel()), + * dbesc($r1[$x]['xchan_url']), + * intval(TERM_MENTION) + * ); + * if($r) + * $r1[$x]['unseen'] = ((array_key_exists('unseen',$r1[$x])) ? $r1[$x]['unseen'] + $r[0]['unseen'] : $r[0]['unseen']); * * end @FIXME */ - } - if($r1) { $o .= '
'; $o .= '

' . t('Forums') . '