"self::" should be "$this->" on non static functions
[friendica.git/.git] / src / Module / Conversation / Timeline.php
index 70491e9..9088854 100644 (file)
@@ -26,6 +26,7 @@ use Friendica\App\Mode;
 use Friendica\BaseModule;
 use Friendica\Content\Conversation\Collection\Timelines;
 use Friendica\Content\Conversation\Entity\Channel as ChannelEntity;
+use Friendica\Content\Conversation\Entity\Community;
 use Friendica\Content\Conversation\Entity\UserDefinedChannel as UserDefinedChannelEntity;
 use Friendica\Content\Conversation\Repository\UserDefinedChannel;
 use Friendica\Core\Cache\Capability\ICanCache;
@@ -71,6 +72,8 @@ class Timeline extends BaseModule
        /** @var bool */
        protected $update;
        /** @var bool */
+       protected $ping;
+       /** @var bool */
        protected $raw;
        /** @var string */
        protected $order;
@@ -458,7 +461,7 @@ class Timeline extends BaseModule
 
                if (!empty($channel->fullTextSearch)) {
                        if (!empty($channel->includeTags)) {
-                               $additional = self:: addIncludeTags($channel->includeTags);
+                               $additional = $this->addIncludeTags($channel->includeTags);
                        } else {
                                $additional = '';
                        }
@@ -470,10 +473,10 @@ class Timeline extends BaseModule
                        }
 
                        if (!empty($channel->mediaType)) {
-                               $additional .= self::addMediaTerms($channel->mediaType);
+                               $additional .= $this->addMediaTerms($channel->mediaType);
                        }
 
-                       $additional .= self::addLanguageSearchTerms($uid, $channel->languages);
+                       $additional .= $this->addLanguageSearchTerms($uid, $channel->languages);
 
                        if ($additional) {
                                $searchterms = '+(' . trim($channel->fullTextSearch) . ')' . $additional;
@@ -683,10 +686,10 @@ class Timeline extends BaseModule
        {
                $items = $this->selectItems();
 
-               if ($this->selectedTab == 'local') {
+               if ($this->selectedTab == Community::LOCAL) {
                        $maxpostperauthor = (int)$this->config->get('system', 'max_author_posts_community_page');
                        $key = 'author-id';
-               } elseif ($this->selectedTab == 'global') {
+               } elseif ($this->selectedTab == Community::GLOBAL) {
                        $maxpostperauthor = (int)$this->config->get('system', 'max_server_posts_community_page');
                        $key = 'author-gsid';
                } else {
@@ -752,7 +755,7 @@ class Timeline extends BaseModule
        {
                $this->order = 'received';
 
-               if ($this->selectedTab == 'local') {
+               if ($this->selectedTab == Community::LOCAL) {
                        $condition = ["`wall` AND `origin` AND `private` = ?", Item::PUBLIC];
                } elseif ($this->selectedTab == 'global') {
                        $condition = ["`uid` = ? AND `private` = ?", 0, Item::PUBLIC];
@@ -788,7 +791,11 @@ class Timeline extends BaseModule
                }
 
                $items = [];
-               $result = Post::selectThreadForUser($this->session->getLocalUserId() ?: 0, ['uri-id', 'received', 'author-id', 'author-gsid'], $condition, $params);
+               if ($this->selectedTab ==  Community::LOCAL) {
+                       $result = Post::selectOriginThread(['uri-id', 'received', 'author-id', 'author-gsid'], $condition, $params);
+               } else {
+                       $result = Post::selectThreadForUser($this->session->getLocalUserId() ?: 0, ['uri-id', 'received', 'author-id', 'author-gsid'], $condition, $params);
+               }
 
                while ($item = $this->database->fetch($result)) {
                        $item['comments'] = 0;
@@ -823,7 +830,7 @@ class Timeline extends BaseModule
         */
        protected function setItemsSeenByCondition(array $condition)
        {
-               if (empty($condition)) {
+               if (empty($condition) || $this->ping) {
                        return;
                }