X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FConversation%2FFactory%2FUserDefinedChannel.php;h=12816126dbe12b24ffd23902d51cfa957753737c;hb=710f9eecb2b270b43bd1ed2a36e8d570ae71e8a6;hp=fe469a7b6f97caf51927208ad022eb7732ce3869;hpb=ed24d06e0c676662fe1c5a7656049daae8bf3358;p=friendica.git diff --git a/src/Content/Conversation/Factory/UserDefinedChannel.php b/src/Content/Conversation/Factory/UserDefinedChannel.php index fe469a7b6f..12816126db 100644 --- a/src/Content/Conversation/Factory/UserDefinedChannel.php +++ b/src/Content/Conversation/Factory/UserDefinedChannel.php @@ -21,36 +21,31 @@ namespace Friendica\Content\Conversation\Factory; +use Friendica\Capabilities\ICanCreateFromTableRow; use Friendica\Content\Conversation\Collection\Timelines; -use Friendica\Content\Conversation\Repository\Channel as ChannelRepository; -use Friendica\Core\Config\Capability\IManageConfigValues; -use Friendica\Core\L10n; -use Psr\Log\LoggerInterface; +use Friendica\Content\Conversation\Entity; -final class UserDefinedChannel extends Timeline +final class UserDefinedChannel extends Timeline implements ICanCreateFromTableRow { - public function __construct(ChannelRepository $channel, L10n $l10n, LoggerInterface $logger, IManageConfigValues $config) - { - parent::__construct($channel, $l10n, $logger, $config); - } - - /** - * List of available user defined channels - * - * @param integer $uid - * @return Timelines - */ - public function getForUser(int $uid): Timelines + public function isTimeline(string $selectedTab, int $uid): bool { - foreach ($this->channel->selectByUid($uid) as $channel) { - $tabs[] = $channel; - } - - return new Timelines($tabs); + return is_numeric($selectedTab) && $uid && $this->channelRepository->existsById($selectedTab, $uid); } - public function isTimeline(string $selectedTab, int $uid): bool + public function createFromTableRow(array $row): Entity\UserDefinedChannel { - return is_numeric($selectedTab) && $uid && $this->channel->existsById($selectedTab, $uid); + return new Entity\UserDefinedChannel( + $row['id'] ?? null, + $row['label'], + $row['description'] ?? null, + $row['access-key'] ?? null, + null, + $row['uid'], + $row['include-tags'] ?? null, + $row['exclude-tags'] ?? null, + $row['full-text-search'] ?? null, + $row['media-type'] ?? null, + $row['circle'] ?? null, + ); } }