]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Conversation/Community.php
Update function / rearrange tab order
[friendica.git] / src / Module / Conversation / Community.php
index 63cde443aee5e568a454de8c8004a2534640b393..9772248428e4bb404177ff2dc8c5c1d0adb60a70 100644 (file)
@@ -24,6 +24,7 @@ namespace Friendica\Module\Conversation;
 
 use Friendica\BaseModule;
 use Friendica\Content\BoundariesPager;
+use Friendica\Content\Conversation;
 use Friendica\Content\Feature;
 use Friendica\Content\Nav;
 use Friendica\Content\Text\HTML;
@@ -91,7 +92,7 @@ class Community extends BaseModule
                                        'accesskey' => 'l'
                                ];
                        }
-       
+
                        if (DI::userSession()->isAuthenticated() || in_array(self::$page_style, [self::LOCAL_AND_GLOBAL, self::GLOBAL])) {
                                $tabs[] = [
                                        'label' => DI::l10n()->t('Global Community'),
@@ -109,14 +110,14 @@ class Community extends BaseModule
                        Nav::setSelected('community');
 
                        DI::page()['aside'] .= Widget::accountTypes('community/' . self::$content, self::$accountTypeString);
-       
+
                        if (DI::userSession()->getLocalUserId() && DI::config()->get('system', 'community_no_sharer')) {
                                $path = self::$content;
                                if (!empty($this->parameters['accounttype'])) {
                                        $path .= '/' . $this->parameters['accounttype'];
                                }
                                $query_parameters = [];
-               
+
                                if (!empty($_GET['min_id'])) {
                                        $query_parameters['min_id'] = $_GET['min_id'];
                                }
@@ -126,7 +127,7 @@ class Community extends BaseModule
                                if (!empty($_GET['last_commented'])) {
                                        $query_parameters['max_id'] = $_GET['last_commented'];
                                }
-               
+
                                $path_all = $path . (!empty($query_parameters) ? '?' . http_build_query($query_parameters) : '');
                                $path_no_sharer = $path . '?' . http_build_query(array_merge($query_parameters, ['no_sharer' => true]));
                                DI::page()['aside'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/community_sharer.tpl'), [
@@ -136,9 +137,10 @@ class Community extends BaseModule
                                        '$no_sharer'       => !empty($_REQUEST['no_sharer']),
                                        '$all'             => DI::l10n()->t('Include'),
                                        '$no_sharer_label' => DI::l10n()->t('Hide'),
+                                       '$base'            => 'community',
                                ]);
                        }
-       
+
                        if (Feature::isEnabled(DI::userSession()->getLocalUserId(), 'trending_tags')) {
                                DI::page()['aside'] .= TrendingTags::getHTML(self::$content);
                        }
@@ -156,7 +158,7 @@ class Community extends BaseModule
                        return $o;
                }
 
-               $o .= DI::conversation()->create($items, 'community', false, false, 'commented', DI::userSession()->getLocalUserId());
+               $o .= DI::conversation()->render($items, Conversation::MODE_COMMUNITY, false, false, 'commented', DI::userSession()->getLocalUserId());
 
                $pager = new BoundariesPager(
                        DI::l10n(),
@@ -244,8 +246,8 @@ class Community extends BaseModule
                }
 
                self::$min_id = $_GET['min_id'] ?? null;
-               self::$max_id   = $_GET['max_id']   ?? null;
-               self::$max_id   = $_GET['last_commented'] ?? self::$max_id;
+               self::$max_id = $_GET['max_id'] ?? null;
+               self::$max_id = $_GET['last_commented'] ?? self::$max_id;
        }
 
        /**
@@ -301,7 +303,7 @@ class Community extends BaseModule
        }
 
        /**
-        * Database query for the comunity page
+        * Database query for the community page
         *
         * @param $min_id
         * @param $max_id
@@ -338,7 +340,7 @@ class Community extends BaseModule
                                $condition[0] .= " AND NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `post-user`.`uid` = ? AND `post-user`.`uri-id` = `post-thread-user-view`.`uri-id`)";
                                $condition[] = DI::userSession()->getLocalUserId();
                        }
-       
+
                        if (isset($max_id)) {
                                $condition[0] .= " AND `commented` < ?";
                                $condition[] = $max_id;
@@ -355,7 +357,7 @@ class Community extends BaseModule
                        }
                }
 
-               $r = Post::selectThreadForUser(0, ['uri-id', 'commented', 'author-link'], $condition, $params);
+               $r = Post::selectThreadForUser(DI::userSession()->getLocalUserId() ?: 0, ['uri-id', 'commented', 'author-link'], $condition, $params);
 
                $items = Post::toArray($r);
                if (empty($items)) {