]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #4581 from annando/issue-4497
authorHypolite Petovan <mrpetovan@gmail.com>
Sun, 11 Mar 2018 14:10:06 +0000 (10:10 -0400)
committerGitHub <noreply@github.com>
Sun, 11 Mar 2018 14:10:06 +0000 (10:10 -0400)
Issue 4497: Forum feeds had been empty

src/Protocol/OStatus.php

index c6f840a66e0b60150f9d57b0574e26df51b88527..710ce11e8f816b498997869109d3276c08c99ead 100644 (file)
@@ -2094,7 +2094,7 @@ class OStatus
                }
 
                $owner = dba::fetch_first(
-                       "SELECT `contact`.*, `user`.`nickname`, `user`.`timezone`, `user`.`page-flags`
+                       "SELECT `contact`.*, `user`.`nickname`, `user`.`timezone`, `user`.`page-flags`, `user`.`account-type`
                                FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
                                WHERE `contact`.`self` AND `user`.`nickname` = ? LIMIT 1",
                        $owner_nick
@@ -2119,12 +2119,14 @@ class OStatus
                        $sql_extra .= sprintf(" AND `item`.`object-type` = '%s' ", dbesc(ACTIVITY_OBJ_COMMENT));
                }
 
+               if ($owner['account-type'] != ACCOUNT_TYPE_COMMUNITY) {
+                       $sql_extra .= sprintf(" AND `item`.`contact-id` = %d AND `item`.`author-id` = %d ", intval($owner["id"]), intval($authorid));
+               }
+
                $items = q(
                        "SELECT `item`.*, `item`.`id` AS `item_id` FROM `item` USE INDEX (`uid_contactid_created`)
                                STRAIGHT_JOIN `thread` ON `thread`.`iid` = `item`.`parent`
                                WHERE `item`.`uid` = %d
-                               AND `item`.`contact-id` = %d
-                               AND `item`.`author-id` = %d
                                AND `item`.`created` > '%s'
                                AND NOT `item`.`deleted`
                                AND NOT `item`.`private`
@@ -2133,8 +2135,6 @@ class OStatus
                                $sql_extra
                                ORDER BY `item`.`created` DESC LIMIT %d",
                        intval($owner["uid"]),
-                       intval($owner["id"]),
-                       intval($authorid),
                        dbesc($check_date),
                        dbesc(NETWORK_OSTATUS),
                        dbesc(NETWORK_DFRN),