]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Settings/Display.php
Merge branch 'friendica:2023.09-rc' into Leftovers-from-PR-#13339
[friendica.git] / src / Module / Settings / Display.php
index 3c5311482f6dd8237fa10ca678003a9944ac6d2d..b5dbf01eb810161a3e9022c8eca2cdaf369a22be 100644 (file)
@@ -28,6 +28,7 @@ use Friendica\Content\Conversation\Factory\Channel as ChannelFactory;
 use Friendica\Content\Conversation\Factory\Community as CommunityFactory;
 use Friendica\Content\Conversation\Factory\Network as NetworkFactory;
 use Friendica\Content\Conversation\Factory\Timeline as TimelineFactory;
+use Friendica\Content\Conversation\Repository;
 use Friendica\Core\Config\Capability\IManageConfigValues;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
@@ -58,6 +59,8 @@ class Display extends BaseSettings
        private $systemMessages;
        /** @var ChannelFactory */
        protected $channel;
+       /** @var Repository\UserDefinedChannel */
+       protected $userDefinedChannel;
        /** @var CommunityFactory */
        protected $community;
        /** @var NetworkFactory */
@@ -65,18 +68,19 @@ class Display extends BaseSettings
        /** @var TimelineFactory */
        protected $timeline;
 
-       public function __construct(NetworkFactory $network, CommunityFactory $community, ChannelFactory $channel, TimelineFactory $timeline, SystemMessages $systemMessages, App $app, IManagePersonalConfigValues $pConfig, IManageConfigValues $config, IHandleUserSessions $session, App\Page $page, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
+       public function __construct(Repository\UserDefinedChannel $userDefinedChannel, NetworkFactory $network, CommunityFactory $community, ChannelFactory $channel, TimelineFactory $timeline, SystemMessages $systemMessages, App $app, IManagePersonalConfigValues $pConfig, IManageConfigValues $config, IHandleUserSessions $session, App\Page $page, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
        {
                parent::__construct($session, $page, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
-               $this->config         = $config;
-               $this->pConfig        = $pConfig;
-               $this->app            = $app;
-               $this->systemMessages = $systemMessages;
-               $this->timeline       = $timeline;
-               $this->channel        = $channel;
-               $this->community      = $community;
-               $this->network        = $network;
+               $this->config             = $config;
+               $this->pConfig            = $pConfig;
+               $this->app                = $app;
+               $this->systemMessages     = $systemMessages;
+               $this->timeline           = $timeline;
+               $this->channel            = $channel;
+               $this->community          = $community;
+               $this->network            = $network;
+               $this->userDefinedChannel = $userDefinedChannel;
        }
 
        protected function post(array $request = [])
@@ -263,8 +267,8 @@ class Display extends BaseSettings
                        $timelines[] = [
                                'label'        => $timeline->label,
                                'description'  => $timeline->description,
-                               'enable'       => ["enable{$timeline->code}", '', in_array($timeline->code, $enabled_timelines)],
-                               'bookmark'     => ["bookmark{$timeline->code}", '', in_array($timeline->code, $bookmarked_timelines)],
+                               'enable'       => ["enable[{$timeline->code}]", '', in_array($timeline->code, $enabled_timelines)],
+                               'bookmark'     => ["bookmark[{$timeline->code}]", '', in_array($timeline->code, $bookmarked_timelines)],
                        ];
                }
 
@@ -349,7 +353,11 @@ class Display extends BaseSettings
                        return new Timelines($timelines);
                }
 
-               foreach ($this->channel->getForUser($uid) as $channel) {
+               foreach ($this->channel->getTimelines($uid) as $channel) {
+                       $timelines[] = $channel;
+               }
+
+               foreach ($this->userDefinedChannel->selectByUid($uid) as $channel) {
                        $timelines[] = $channel;
                }