User defined channels can now have got individual language definitions

This commit is contained in:
Michael
2024-01-03 19:17:14 +00:00
parent 21b16ef822
commit da3d390187
8 changed files with 43 additions and 9 deletions
+5 -1
View File
@@ -32,6 +32,7 @@ namespace Friendica\Content\Conversation\Entity;
* @property-read string $excludeTags The tags to exclude in the channel
* @property-read string $fullTextSearch full text search pattern
* @property-read int $mediaType Media types that are included in the channel
* @property-read array $languages Channel languages
* @property-read int $circle Circle or timeline this channel is based on
*/
class Timeline extends \Friendica\BaseEntity
@@ -58,8 +59,10 @@ class Timeline extends \Friendica\BaseEntity
protected $fullTextSearch;
/** @var int */
protected $mediaType;
/** @var array */
protected $languages;
public function __construct(string $code = null, string $label = null, string $description = null, string $accessKey = null, string $path = null, int $uid = null, string $includeTags = null, string $excludeTags = null, string $fullTextSearch = null, int $mediaType = null, int $circle = null)
public function __construct(string $code = null, string $label = null, string $description = null, string $accessKey = null, string $path = null, int $uid = null, string $includeTags = null, string $excludeTags = null, string $fullTextSearch = null, int $mediaType = null, int $circle = null, array $languages = null)
{
$this->code = $code;
$this->label = $label;
@@ -72,5 +75,6 @@ class Timeline extends \Friendica\BaseEntity
$this->fullTextSearch = $fullTextSearch;
$this->mediaType = $mediaType;
$this->circle = $circle;
$this->languages = $languages;
}
}
@@ -22,7 +22,6 @@
namespace Friendica\Content\Conversation\Factory;
use Friendica\Capabilities\ICanCreateFromTableRow;
use Friendica\Content\Conversation\Collection\Timelines;
use Friendica\Content\Conversation\Entity;
final class UserDefinedChannel extends Timeline implements ICanCreateFromTableRow
@@ -34,6 +33,10 @@ final class UserDefinedChannel extends Timeline implements ICanCreateFromTableRo
public function createFromTableRow(array $row): Entity\UserDefinedChannel
{
if (is_string($row['languages'])) {
$row['languages'] = unserialize($row['languages']);
}
return new Entity\UserDefinedChannel(
$row['id'] ?? null,
$row['label'],
@@ -46,6 +49,7 @@ final class UserDefinedChannel extends Timeline implements ICanCreateFromTableRo
$row['full-text-search'] ?? null,
$row['media-type'] ?? null,
$row['circle'] ?? null,
$row['languages'] ?? null,
);
}
}
@@ -124,6 +124,7 @@ class UserDefinedChannel extends \Friendica\BaseRepository
'exclude-tags' => $Channel->excludeTags,
'full-text-search' => $Channel->fullTextSearch,
'media-type' => $Channel->mediaType,
'languages' => serialize($Channel->languages),
];
if ($Channel->code) {