X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FConversation%2FCommunity.php;h=8be5361deb3bc49e2e859103e220c680a02c5f29;hb=8e6483970a46e77ffe0e306f72b884bcb11c1765;hp=58af38eb16d72f11d5cb715a0ea919bc92571f39;hpb=e0d03615bcd3002871ad1e4e704db67890c041a0;p=friendica.git diff --git a/src/Module/Conversation/Community.php b/src/Module/Conversation/Community.php index 58af38eb16..8be5361deb 100644 --- a/src/Module/Conversation/Community.php +++ b/src/Module/Conversation/Community.php @@ -81,7 +81,7 @@ class Community extends BaseModule $items = self::getItems(); if (!DBA::isResult($items)) { - info(DI::l10n()->t('No results.')); + notice(DI::l10n()->t('No results.')); return $o; } @@ -280,58 +280,38 @@ class Community extends BaseModule $r = false; if (self::$content == 'local') { - $values = []; - - $sql_accounttype = ''; - $sql_boundaries = ''; if (!is_null(self::$accounttype)) { - $sql_accounttype = " AND `user`.`account-type` = ?"; - $values[] = [self::$accounttype]; - } - - if (isset($since_id)) { - $sql_boundaries .= " AND `thread`.`commented` > ?"; - $values[] = $since_id; - } - - if (isset($max_id)) { - $sql_boundaries .= " AND `thread`.`commented` < ?"; - $values[] = $max_id; + $condition = ["`wall` AND `origin` AND `private` = ? AND `owner`.`contact-type` = ?", Item::PUBLIC, self::$accounttype]; + } else { + $condition = ["`wall` AND `origin` AND `private` = ?", Item::PUBLIC]; } - - $values[] = $itemspage; - - /// @todo Use "unsearchable" here as well (instead of "hidewall") - $r = DBA::p("SELECT `item`.`uri`, `author`.`url` AS `author-link`, `thread`.`commented` FROM `thread` - STRAIGHT_JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall` - STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid` - STRAIGHT_JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id` - WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated` - AND NOT `thread`.`private` AND `thread`.`wall` AND `thread`.`origin` - $sql_accounttype - $sql_boundaries - ORDER BY `thread`.`commented` DESC - LIMIT ?", $values); } elseif (self::$content == 'global') { if (!is_null(self::$accounttype)) { - $condition = ["`uid` = ? AND NOT `author`.`unsearchable` AND NOT `owner`.`unsearchable` AND `owner`.`contact-type` = ?", 0, self::$accounttype]; + $condition = ["`uid` = ? AND `private` = ? AND `owner`.`contact-type` = ?", 0, Item::PUBLIC, self::$accounttype]; } else { - $condition = ["`uid` = ? AND NOT `author`.`unsearchable` AND NOT `owner`.`unsearchable`", 0]; + $condition = ["`uid` = ? AND `private` = ?", 0, Item::PUBLIC]; } + } else { + return []; + } - if (isset($max_id)) { - $condition[0] .= " AND `commented` < ?"; - $condition[] = $max_id; - } + if (local_user() && DI::config()->get('system', 'community_no_followers')) { + $condition[0] .= " AND NOT EXISTS (SELECT `uri-id` FROM `thread` AS t1 WHERE `t1`.`uri-id` = `thread`.`uri-id` AND `t1`.`uid` = ?)"; + $condition[] = local_user(); + } - if (isset($since_id)) { - $condition[0] .= " AND `commented` > ?"; - $condition[] = $since_id; - } + if (isset($max_id)) { + $condition[0] .= " AND `commented` < ?"; + $condition[] = $max_id; + } - $r = Item::selectThreadForUser(0, ['uri', 'commented'], $condition, ['order' => ['commented' => true], 'limit' => $itemspage]); + if (isset($since_id)) { + $condition[0] .= " AND `commented` > ?"; + $condition[] = $since_id; } + $r = Item::selectThreadForUser(0, ['uri', 'commented', 'author-link'], $condition, ['order' => ['commented' => true], 'limit' => $itemspage]); + return DBA::toArray($r); } }