aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM. Dent <dentm42@gmail.com>2018-10-26 17:10:10 +0200
committerM. Dent <dentm42@gmail.com>2018-10-26 17:10:10 +0200
commit302abc2a6018d16c6c2091fa1b6fac3659d091e3 (patch)
tree3037e5f32f6088d4323ea53afb20281e5674af44
parentdf449e7bfeb529c858007c7145f5587e87d87aa6 (diff)
parent2b3cbc638bb626141bce0a6cc9860700823bc24b (diff)
downloadvolse-hubzilla-302abc2a6018d16c6c2091fa1b6fac3659d091e3.tar.gz
volse-hubzilla-302abc2a6018d16c6c2091fa1b6fac3659d091e3.tar.bz2
volse-hubzilla-302abc2a6018d16c6c2091fa1b6fac3659d091e3.zip
Merge branch 'dev' into 'dev'
notifications: fix unseen forum count See merge request hubzilla/core!1351
-rw-r--r--Zotlabs/Module/Ping.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index bc6985301..2ad4f1277 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -634,18 +634,20 @@ class Ping extends \Zotlabs\Web\Controller {
if($vnotify & VNOTIFY_FORUMS) {
$forums = get_forum_channels(local_channel());
- if(! $forums) {
- $result['forums'] = 0;
- }
- else {
-
+ if($forums) {
$perms_sql = item_permissions_sql(local_channel()) . item_normal();
$fcount = count($forums);
$forums['total'] = 0;
for($x = 0; $x < $fcount; $x ++) {
+ $ttype = TERM_FORUM;
+ $p = q("SELECT oid AS parent FROM term WHERE uid = " . intval(local_channel()) . " AND ttype = $ttype AND term = '" . dbesc($forums[$x]['xchan_name']) . "'");
+ $p = ids_to_querystr($p, 'parent');
+
+ $pquery = (($p) ? "OR parent IN ( $p )" : '');
+
$r = q("select sum(item_unseen) as unseen from item
- where uid = %d and owner_xchan = '%s' and item_unseen = 1 $perms_sql ",
+ where uid = %d and ( owner_xchan = '%s' $pquery ) and item_unseen = 1 $perms_sql ",
intval(local_channel()),
dbesc($forums[$x]['xchan_hash'])
);