Merge pull request #13861 from annando/size

Filter user defined channels by size
This commit is contained in:
Hypolite Petovan 2024-01-30 17:52:40 -05:00 committed by GitHub
commit fef14d96c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 153 additions and 62 deletions

View file

@ -1,6 +1,6 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 2024.03-dev (Yellow Archangel) -- Friendica 2024.03-dev (Yellow Archangel)
-- DB_UPDATE_VERSION 1548 -- DB_UPDATE_VERSION 1549
-- ------------------------------------------ -- ------------------------------------------
@ -502,6 +502,8 @@ CREATE TABLE IF NOT EXISTS `channel` (
`access-key` varchar(1) COMMENT 'Access key', `access-key` varchar(1) COMMENT 'Access key',
`include-tags` varchar(1023) COMMENT 'Comma separated list of tags that will be included in the channel', `include-tags` varchar(1023) COMMENT 'Comma separated list of tags that will be included in the channel',
`exclude-tags` varchar(1023) COMMENT 'Comma separated list of tags that aren\'t allowed in the channel', `exclude-tags` varchar(1023) COMMENT 'Comma separated list of tags that aren\'t allowed in the channel',
`min-size` int unsigned COMMENT 'Minimum post size',
`max-size` int unsigned COMMENT 'Maximum post size',
`full-text-search` varchar(1023) COMMENT 'Full text search pattern, see https://mariadb.com/kb/en/full-text-index-overview/#in-boolean-mode', `full-text-search` varchar(1023) COMMENT 'Full text search pattern, see https://mariadb.com/kb/en/full-text-index-overview/#in-boolean-mode',
`media-type` smallint unsigned COMMENT 'Filtered media types', `media-type` smallint unsigned COMMENT 'Filtered media types',
`languages` mediumtext COMMENT 'Desired languages', `languages` mediumtext COMMENT 'Desired languages',
@ -1346,6 +1348,7 @@ CREATE TABLE IF NOT EXISTS `post-engagement` (
`media-type` tinyint NOT NULL DEFAULT 0 COMMENT 'Type of media in a bit array (1 = image, 2 = video, 4 = audio', `media-type` tinyint NOT NULL DEFAULT 0 COMMENT 'Type of media in a bit array (1 = image, 2 = video, 4 = audio',
`language` varchar(128) COMMENT 'Language information about this post', `language` varchar(128) COMMENT 'Language information about this post',
`searchtext` mediumtext COMMENT 'Simplified text for the full text search', `searchtext` mediumtext COMMENT 'Simplified text for the full text search',
`size` int unsigned COMMENT 'Body size',
`created` datetime COMMENT '', `created` datetime COMMENT '',
`restricted` boolean NOT NULL DEFAULT '0' COMMENT 'If true, this post is either unlisted or not from a federated network', `restricted` boolean NOT NULL DEFAULT '0' COMMENT 'If true, this post is either unlisted or not from a federated network',
`comments` mediumint unsigned COMMENT 'Number of comments', `comments` mediumint unsigned COMMENT 'Number of comments',

View file

@ -56,36 +56,37 @@ Each channel is defined by these values:
Additional keywords for the full text search Additional keywords for the full text search
--- ---
Additionally to the search for content, there are additional keywords that can be used in the full text search: Additionally to the search for content, there are keywords that can be used in the full text search.
Alternatives are presented with "|".
* from - Use "from:nickname" or "from:nickname@domain.tld" to search for posts from a specific author. * from - Use "from:nickname" or "from:nickname@domain.tld" to search for posts from a specific author.
* to - Use "from:nickname" or "from:nickname@domain.tld" to search for posts with the given contact as receiver. * to - Use "from:nickname" or "from:nickname@domain.tld" to search for posts with the given contact as receiver.
* group - Use "group:nickname" or "group:nickname@domain.tld" to search for group post of the given group. * group - Use "group:nickname" or "group:nickname@domain.tld" to search for group post of the given group.
* application - Use "application:nickname" or "application:nickname@domain.tld" to search for posts that had been reshared by the given relay application. * application | relay - Use "application:nickname" or "application:nickname@domain.tld" to search for posts that had been reshared by the given relay application.
* server - Use "server:hostname" to search for posts from a specific server. In the case of group postings, the search text contains both the hostname of the group server and the author's hostname. * server - Use "server:hostname" to search for posts from a specific server. In the case of group postings, the search text contains both the hostname of the group server and the author's hostname.
* source - The ActivityPub type of the post source. Use this for example to include or exclude group posts or posts from services (aka bots). * source - The ActivityPub type of the post source. Use this for example to include or exclude group posts or posts from services (aka bots).
* source:person - The post is created by a regular user account. * source:person - The post is created by a regular user account.
* source:organization - The post is created by an organisation. * source:organization - The post is created by an organisation.
* source:group - The post is created by or distributed via a group. * source:group - The post is created by or distributed via a group.
* source:service - The posts originates from a service account. This source type is often used to mark bot accounts. * source:service | source:news - The posts originates from a service account. This source type is often used to mark bot accounts.
* source:application - The post is created by an application. This is most likely unused in the fediverse for post creation. * source:application | source:relay - The post is created by an application. This is most likely unused in the fediverse for post creation.
* tag - Use "tag:tagname" to search for a specific tag. * tag - Use "tag:tagname" to search for a specific tag.
* network - Use this to include or exclude some networks from your channel. * network | net - Use this to include or exclude some networks from your channel.
* network:apub - ActivityPub (Used by the systems in the Fediverse) * network:apub | network:activitypub - ActivityPub (Used by the systems in the Fediverse)
* network:dfrn - Legacy Friendica protocol. Nowayday Friendica mostly uses ActivityPub. * network:dfrn | network:friendica - Legacy Friendica protocol. Nowayday Friendica mostly uses ActivityPub.
* network:dspr - The Diaspora protocol is mainly used by Diaspora itself. Some other systems support the protocol as well like Hubzilla, Socialhome or Ganggo. * network:dspr | network:diaspora - The Diaspora protocol is mainly used by Diaspora itself. Some other systems support the protocol as well like Hubzilla, Socialhome or Ganggo.
* network:feed - RSS/Atom feeds * network:feed - RSS/Atom feeds
* network:mail - Mails that had been imported via IMAP. * network:mail - Mails that had been imported via IMAP.
* network:stat - The OStatus protocol is mainly used by old GNU Social installations. * network:stat | network:ostatus - The OStatus protocol is mainly used by old GNU Social installations.
* network:dscs - Posts that are received by the Discourse connector. * network:dscs | network:discourse - Posts that are received by the Discourse connector.
* network:tmbl - Posts that are received by the Tumblr connector. * network:tmbl | network:tumblr - Posts that are received by the Tumblr connector.
* network:bsky - Posts that are received by the Bluesky connector. * network:bsky | network:bluesky - Posts that are received by the Bluesky connector.
* platform - Use this to include or exclude some platforms from your channel, e.g. "+platform:friendica". In the case of group postings, the search text contains both the platform of the group server and the author's platform. * platform - Use this to include or exclude some platforms from your channel, e.g. "+platform:friendica". In the case of group postings, the search text contains both the platform of the group server and the author's platform.
* visibility - You have the choice between different visibilities. You can only see unlisted or private posts that you have the access for. * visibility - You have the choice between different visibilities. You can only see unlisted or private posts that you have the access for.
* visibility:public * visibility:public
* visibility:unlisted * visibility:unlisted
* visibility:private * visibility:private
* language - Use "language:code" to search for posts with the given language in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format. * language | lang - Use "language:code" to search for posts with the given language in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.
Remember that you can combine these kerywords. Remember that you can combine these kerywords.
So for example you can create a channel with all posts that talk about the Fediverse - that aren't posted in the Fediverse with the search terms: "fediverse -network:apub -network:dfrn" So for example you can create a channel with all posts that talk about the Fediverse - that aren't posted in the Fediverse with the search terms: "fediverse -network:apub -network:dfrn"

View file

@ -16,6 +16,8 @@ Fields
| access-key | Access key | varchar(1) | YES | | NULL | | | access-key | Access key | varchar(1) | YES | | NULL | |
| include-tags | Comma separated list of tags that will be included in the channel | varchar(1023) | YES | | NULL | | | include-tags | Comma separated list of tags that will be included in the channel | varchar(1023) | YES | | NULL | |
| exclude-tags | Comma separated list of tags that aren't allowed in the channel | varchar(1023) | YES | | NULL | | | exclude-tags | Comma separated list of tags that aren't allowed in the channel | varchar(1023) | YES | | NULL | |
| min-size | Minimum post size | int unsigned | YES | | NULL | |
| max-size | Maximum post size | int unsigned | YES | | NULL | |
| full-text-search | Full text search pattern, see https://mariadb.com/kb/en/full-text-index-overview/#in-boolean-mode | varchar(1023) | YES | | NULL | | | full-text-search | Full text search pattern, see https://mariadb.com/kb/en/full-text-index-overview/#in-boolean-mode | varchar(1023) | YES | | NULL | |
| media-type | Filtered media types | smallint unsigned | YES | | NULL | | | media-type | Filtered media types | smallint unsigned | YES | | NULL | |
| languages | Desired languages | mediumtext | YES | | NULL | | | languages | Desired languages | mediumtext | YES | | NULL | |

View file

@ -14,6 +14,7 @@ Fields
| media-type | Type of media in a bit array (1 = image, 2 = video, 4 = audio | tinyint | NO | | 0 | | | media-type | Type of media in a bit array (1 = image, 2 = video, 4 = audio | tinyint | NO | | 0 | |
| language | Language information about this post | varchar(128) | YES | | NULL | | | language | Language information about this post | varchar(128) | YES | | NULL | |
| searchtext | Simplified text for the full text search | mediumtext | YES | | NULL | | | searchtext | Simplified text for the full text search | mediumtext | YES | | NULL | |
| size | Body size | int unsigned | YES | | NULL | |
| created | | datetime | YES | | NULL | | | created | | datetime | YES | | NULL | |
| restricted | If true, this post is either unlisted or not from a federated network | boolean | NO | | 0 | | | restricted | If true, this post is either unlisted or not from a federated network | boolean | NO | | 0 | |
| comments | Number of comments | mediumint unsigned | YES | | NULL | | | comments | Number of comments | mediumint unsigned | YES | | NULL | |

View file

@ -30,6 +30,8 @@ namespace Friendica\Content\Conversation\Entity;
* @property-read int $uid User of the channel * @property-read int $uid User of the channel
* @property-read string $includeTags The tags to include in the channel * @property-read string $includeTags The tags to include in the channel
* @property-read string $excludeTags The tags to exclude in the channel * @property-read string $excludeTags The tags to exclude in the channel
* @property-read int $minSize Minimum content size
* @property-read int $maxSize Maximum content size
* @property-read string $fullTextSearch full text search pattern * @property-read string $fullTextSearch full text search pattern
* @property-read int $mediaType Media types that are included in the channel * @property-read int $mediaType Media types that are included in the channel
* @property-read array $languages Channel languages * @property-read array $languages Channel languages
@ -57,6 +59,10 @@ class Timeline extends \Friendica\BaseEntity
protected $includeTags; protected $includeTags;
/** @var string */ /** @var string */
protected $excludeTags; protected $excludeTags;
/** @var int */
protected $minSize;
/** @var int */
protected $maxSize;
/** @var string */ /** @var string */
protected $fullTextSearch; protected $fullTextSearch;
/** @var int */ /** @var int */
@ -68,7 +74,7 @@ class Timeline extends \Friendica\BaseEntity
/** @var bool */ /** @var bool */
protected $valid; protected $valid;
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, bool $publish = null, bool $valid = 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, bool $publish = null, bool $valid = null, int $minSize = null, int $maxSize = null)
{ {
$this->code = $code; $this->code = $code;
$this->label = $label; $this->label = $label;
@ -78,6 +84,8 @@ class Timeline extends \Friendica\BaseEntity
$this->uid = $uid; $this->uid = $uid;
$this->includeTags = $includeTags; $this->includeTags = $includeTags;
$this->excludeTags = $excludeTags; $this->excludeTags = $excludeTags;
$this->minSize = $minSize;
$this->maxSize = $maxSize;
$this->fullTextSearch = $fullTextSearch; $this->fullTextSearch = $fullTextSearch;
$this->mediaType = $mediaType; $this->mediaType = $mediaType;
$this->circle = $circle; $this->circle = $circle;

View file

@ -52,6 +52,8 @@ final class UserDefinedChannel extends Timeline implements ICanCreateFromTableRo
$row['languages'] ?? null, $row['languages'] ?? null,
$row['publish'] ?? null, $row['publish'] ?? null,
$row['valid'] ?? null, $row['valid'] ?? null,
$row['min-size'] ?? null,
$row['max-size'] ?? null,
); );
} }
} }

View file

@ -130,6 +130,8 @@ class UserDefinedChannel extends \Friendica\BaseRepository
'circle' => $Channel->circle, 'circle' => $Channel->circle,
'include-tags' => $Channel->includeTags, 'include-tags' => $Channel->includeTags,
'exclude-tags' => $Channel->excludeTags, 'exclude-tags' => $Channel->excludeTags,
'min-size' => $Channel->minSize,
'max-size' => $Channel->maxSize,
'full-text-search' => $Channel->fullTextSearch, 'full-text-search' => $Channel->fullTextSearch,
'media-type' => $Channel->mediaType, 'media-type' => $Channel->mediaType,
'languages' => serialize($Channel->languages), 'languages' => serialize($Channel->languages),

View file

@ -39,6 +39,10 @@ use Friendica\Util\DateTimeFormat;
class Engagement class Engagement
{ {
const KEYWORDS = ['source', 'server', 'from', 'to', 'group', 'application', 'tag', 'network', 'platform', 'visibility', 'language']; const KEYWORDS = ['source', 'server', 'from', 'to', 'group', 'application', 'tag', 'network', 'platform', 'visibility', 'language'];
const SHORTCUTS = ['lang' => 'language', 'net' => 'network', 'relay' => 'application'];
const ALTERNATIVES = ['source:news' => 'source:service', 'source:relay' => 'source:application',
'network:activitypub' => 'network:apub', 'network:friendica' => 'network:dfrn', 'network:diaspora' => 'network:dspr', 'network:ostatus' => 'network:stat',
'network:discourse' => 'network:dscs', 'network:tumblr' => 'network:tmbl', 'network:bluesky' => 'network:bsky'];
/** /**
* Store engagement data from an item array * Store engagement data from an item array
@ -101,6 +105,7 @@ class Engagement
'media-type' => $mediatype, 'media-type' => $mediatype,
'language' => $parent['language'], 'language' => $parent['language'],
'searchtext' => $searchtext, 'searchtext' => $searchtext,
'size' => self::getContentSize($parent),
'created' => $parent['created'], 'created' => $parent['created'],
'restricted' => !in_array($item['network'], Protocol::FEDERATED) || ($parent['private'] != Item::PUBLIC), 'restricted' => !in_array($item['network'], Protocol::FEDERATED) || ($parent['private'] != Item::PUBLIC),
'comments' => DBA::count('post', ['parent-uri-id' => $item['parent-uri-id'], 'gravity' => Item::GRAVITY_COMMENT]), 'comments' => DBA::count('post', ['parent-uri-id' => $item['parent-uri-id'], 'gravity' => Item::GRAVITY_COMMENT]),
@ -125,6 +130,18 @@ class Engagement
return ($ret && !$exists) ? $engagement['uri-id'] : 0; return ($ret && !$exists) ? $engagement['uri-id'] : 0;
} }
private static function getContentSize(array $item): int
{
$body = ' ' . $item['title'] . ' ' . $item['content-warning'] . ' ' . $item['body'];
$body = BBCode::removeAttachment($body);
$body = BBCode::removeSharedData($body);
$body = preg_replace('/[^@!#]\[url\=.*?\].*?\[\/url\]/ism', '', $body);
$body = BBCode::removeLinks($body);
$msg = BBCode::toPlaintext($body, false);
return mb_strlen($msg);
}
public static function getSearchTextForActivity(string $content, int $author_id, array $tags, array $receivers): string public static function getSearchTextForActivity(string $content, int $author_id, array $tags, array $receivers): string
{ {
$author = Contact::getById($author_id); $author = Contact::getById($author_id);
@ -347,7 +364,15 @@ class Engagement
public static function escapeKeywords(string $fullTextSearch): string public static function escapeKeywords(string $fullTextSearch): string
{ {
foreach (Engagement::KEYWORDS as $keyword) { foreach (SELF::SHORTCUTS as $search => $replace) {
$fullTextSearch = preg_replace('~' . $search . ':(.[\w\*@\.-]+)~', $replace . ':$1', $fullTextSearch);
}
foreach (SELF::ALTERNATIVES as $search => $replace) {
$fullTextSearch = str_replace($search, $replace, $fullTextSearch);
}
foreach (self::KEYWORDS as $keyword) {
$fullTextSearch = preg_replace('~(' . $keyword . '):(.[\w\*@\.-]+)~', '"$1_$2"', $fullTextSearch); $fullTextSearch = preg_replace('~(' . $keyword . '):(.[\w\*@\.-]+)~', '"$1_$2"', $fullTextSearch);
} }
return $fullTextSearch; return $fullTextSearch;

View file

@ -427,6 +427,14 @@ class Timeline extends BaseModule
$condition = DBA::mergeConditions($condition, array_merge(["NOT `uri-id` IN (SELECT `uri-id` FROM `post-tag` INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid` WHERE `post-tag`.`type` = 1 AND `name` IN (" . $placeholders . "))"], $search)); $condition = DBA::mergeConditions($condition, array_merge(["NOT `uri-id` IN (SELECT `uri-id` FROM `post-tag` INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid` WHERE `post-tag`.`type` = 1 AND `name` IN (" . $placeholders . "))"], $search));
} }
if (!is_null($channel->minSize)) {
$condition = DBA::mergeConditions($condition, ["`size` >= ?", $channel->minSize]);
}
if (!is_null($channel->maxSize)) {
$condition = DBA::mergeConditions($condition, ["`size` <= ?", $channel->maxSize]);
}
if (!empty($channel->mediaType)) { if (!empty($channel->mediaType)) {
$condition = DBA::mergeConditions($condition, ["`media-type` & ?", $channel->mediaType]); $condition = DBA::mergeConditions($condition, ["`media-type` & ?", $channel->mediaType]);
} }

View file

@ -83,6 +83,8 @@ class Channels extends BaseSettings
'circle' => (int)$request['new_circle'], 'circle' => (int)$request['new_circle'],
'include-tags' => Strings::cleanTags($request['new_include_tags']), 'include-tags' => Strings::cleanTags($request['new_include_tags']),
'exclude-tags' => Strings::cleanTags($request['new_exclude_tags']), 'exclude-tags' => Strings::cleanTags($request['new_exclude_tags']),
'min-size' => $request['new_min_size'] != '' ? (int)$request['new_min_size'] : null,
'max-size' => $request['new_max_size'] != '' ? (int)$request['new_max_size'] : null,
'full-text-search' => $request['new_text_search'], 'full-text-search' => $request['new_text_search'],
'media-type' => ($request['new_image'] ? 1 : 0) | ($request['new_video'] ? 2 : 0) | ($request['new_audio'] ? 4 : 0), 'media-type' => ($request['new_image'] ? 1 : 0) | ($request['new_video'] ? 2 : 0) | ($request['new_audio'] ? 4 : 0),
'languages' => $request['new_languages'], 'languages' => $request['new_languages'],
@ -112,6 +114,8 @@ class Channels extends BaseSettings
'circle' => (int)$request['circle'][$id], 'circle' => (int)$request['circle'][$id],
'include-tags' => Strings::cleanTags($request['include_tags'][$id]), 'include-tags' => Strings::cleanTags($request['include_tags'][$id]),
'exclude-tags' => Strings::cleanTags($request['exclude_tags'][$id]), 'exclude-tags' => Strings::cleanTags($request['exclude_tags'][$id]),
'min-size' => $request['min_size'][$id] != '' ? (int)$request['min_size'][$id] : null,
'max-size' => $request['max_size'][$id] != '' ? (int)$request['max_size'][$id] : null,
'full-text-search' => $request['text_search'][$id], 'full-text-search' => $request['text_search'][$id],
'media-type' => ($request['image'][$id] ? 1 : 0) | ($request['video'][$id] ? 2 : 0) | ($request['audio'][$id] ? 4 : 0), 'media-type' => ($request['image'][$id] ? 1 : 0) | ($request['video'][$id] ? 2 : 0) | ($request['audio'][$id] ? 4 : 0),
'languages' => $request['languages'][$id], 'languages' => $request['languages'][$id],
@ -181,6 +185,8 @@ class Channels extends BaseSettings
'circle' => ["circle[$channel->code]", $this->t('Circle/Channel'), $channel->circle, '', $circles], 'circle' => ["circle[$channel->code]", $this->t('Circle/Channel'), $channel->circle, '', $circles],
'include_tags' => ["include_tags[$channel->code]", $this->t("Include Tags"), str_replace(',', ', ', $channel->includeTags)], 'include_tags' => ["include_tags[$channel->code]", $this->t("Include Tags"), str_replace(',', ', ', $channel->includeTags)],
'exclude_tags' => ["exclude_tags[$channel->code]", $this->t("Exclude Tags"), str_replace(',', ', ', $channel->excludeTags)], 'exclude_tags' => ["exclude_tags[$channel->code]", $this->t("Exclude Tags"), str_replace(',', ', ', $channel->excludeTags)],
'min_size' => ["min_size[$channel->code]", $this->t("Minimum Size"), $channel->minSize],
'max_size' => ["max_size[$channel->code]", $this->t("Maximum Size"), $channel->maxSize],
'text_search' => ["text_search[$channel->code]", $this->t("Full Text Search"), $channel->fullTextSearch], 'text_search' => ["text_search[$channel->code]", $this->t("Full Text Search"), $channel->fullTextSearch],
'image' => ["image[$channel->code]", $this->t("Images"), $channel->mediaType & 1], 'image' => ["image[$channel->code]", $this->t("Images"), $channel->mediaType & 1],
'video' => ["video[$channel->code]", $this->t("Videos"), $channel->mediaType & 2], 'video' => ["video[$channel->code]", $this->t("Videos"), $channel->mediaType & 2],
@ -200,6 +206,8 @@ class Channels extends BaseSettings
'circle' => ['new_circle', $this->t('Circle/Channel'), 0, $this->t('Select a circle or channel, that your channel should be based on.'), $circles], 'circle' => ['new_circle', $this->t('Circle/Channel'), 0, $this->t('Select a circle or channel, that your channel should be based on.'), $circles],
'include_tags' => ["new_include_tags", $this->t("Include Tags"), '', $this->t('Comma separated list of tags. A post will be used when it contains any of the listed tags.')], 'include_tags' => ["new_include_tags", $this->t("Include Tags"), '', $this->t('Comma separated list of tags. A post will be used when it contains any of the listed tags.')],
'exclude_tags' => ["new_exclude_tags", $this->t("Exclude Tags"), '', $this->t('Comma separated list of tags. If a post contain any of these tags, then it will not be part of nthis channel.')], 'exclude_tags' => ["new_exclude_tags", $this->t("Exclude Tags"), '', $this->t('Comma separated list of tags. If a post contain any of these tags, then it will not be part of nthis channel.')],
'min_size' => ["new_min_size", $this->t("Minimum Size"), '', $this->t('Minimum post size. Leave empty for no minimum size. The size is calculated without links, attached posts, mentions or hashtags.')],
'max_size' => ["new_max_size", $this->t("Maximum Size"), '', $this->t('Maximum post size. Leave empty for no maximum size. The size is calculated without links, attached posts, mentions or hashtags.')],
'text_search' => ["new_text_search", $this->t("Full Text Search"), '', $this->t('Search terms for the body, supports the "boolean mode" operators from MariaDB. See the help for a complete list of operators and additional keywords: %s', '<a href="help/Channels">help/Channels</a>')], 'text_search' => ["new_text_search", $this->t("Full Text Search"), '', $this->t('Search terms for the body, supports the "boolean mode" operators from MariaDB. See the help for a complete list of operators and additional keywords: %s', '<a href="help/Channels">help/Channels</a>')],
'image' => ['new_image', $this->t("Images"), false, $this->t("Check to display images in the channel.")], 'image' => ['new_image', $this->t("Images"), false, $this->t("Check to display images in the channel.")],
'video' => ["new_video", $this->t("Videos"), false, $this->t("Check to display videos in the channel.")], 'video' => ["new_video", $this->t("Videos"), false, $this->t("Check to display videos in the channel.")],

View file

@ -56,7 +56,7 @@ use Friendica\Database\DBA;
// This file is required several times during the test in DbaDefinition which justifies this condition // This file is required several times during the test in DbaDefinition which justifies this condition
if (!defined('DB_UPDATE_VERSION')) { if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1548); define('DB_UPDATE_VERSION', 1549);
} }
return [ return [
@ -560,6 +560,8 @@ return [
"access-key" => ["type" => "varchar(1)", "comment" => "Access key"], "access-key" => ["type" => "varchar(1)", "comment" => "Access key"],
"include-tags" => ["type" => "varchar(1023)", "comment" => "Comma separated list of tags that will be included in the channel"], "include-tags" => ["type" => "varchar(1023)", "comment" => "Comma separated list of tags that will be included in the channel"],
"exclude-tags" => ["type" => "varchar(1023)", "comment" => "Comma separated list of tags that aren't allowed in the channel"], "exclude-tags" => ["type" => "varchar(1023)", "comment" => "Comma separated list of tags that aren't allowed in the channel"],
"min-size" => ["type" => "int unsigned", "comment" => "Minimum post size"],
"max-size" => ["type" => "int unsigned", "comment" => "Maximum post size"],
"full-text-search" => ["type" => "varchar(1023)", "comment" => "Full text search pattern, see https://mariadb.com/kb/en/full-text-index-overview/#in-boolean-mode"], "full-text-search" => ["type" => "varchar(1023)", "comment" => "Full text search pattern, see https://mariadb.com/kb/en/full-text-index-overview/#in-boolean-mode"],
"media-type" => ["type" => "smallint unsigned", "comment" => "Filtered media types"], "media-type" => ["type" => "smallint unsigned", "comment" => "Filtered media types"],
"languages" => ["type" => "mediumtext", "comment" => "Desired languages"], "languages" => ["type" => "mediumtext", "comment" => "Desired languages"],
@ -1367,6 +1369,7 @@ return [
"media-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Type of media in a bit array (1 = image, 2 = video, 4 = audio"], "media-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Type of media in a bit array (1 = image, 2 = video, 4 = audio"],
"language" => ["type" => "varchar(128)", "comment" => "Language information about this post"], "language" => ["type" => "varchar(128)", "comment" => "Language information about this post"],
"searchtext" => ["type" => "mediumtext", "comment" => "Simplified text for the full text search"], "searchtext" => ["type" => "mediumtext", "comment" => "Simplified text for the full text search"],
"size" => ["type" => "int unsigned", "comment" => "Body size"],
"created" => ["type" => "datetime", "comment" => ""], "created" => ["type" => "datetime", "comment" => ""],
"restricted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "If true, this post is either unlisted or not from a federated network"], "restricted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "If true, this post is either unlisted or not from a federated network"],
"comments" => ["type" => "mediumint unsigned", "comment" => "Number of comments"], "comments" => ["type" => "mediumint unsigned", "comment" => "Number of comments"],

View file

@ -67,7 +67,7 @@ msgstr ""
#: src/Module/Register.php:206 src/Module/Register.php:245 #: src/Module/Register.php:206 src/Module/Register.php:245
#: src/Module/Search/Directory.php:37 src/Module/Settings/Account.php:50 #: src/Module/Search/Directory.php:37 src/Module/Settings/Account.php:50
#: src/Module/Settings/Account.php:386 src/Module/Settings/Channels.php:62 #: src/Module/Settings/Account.php:386 src/Module/Settings/Channels.php:62
#: src/Module/Settings/Channels.php:131 src/Module/Settings/Delegation.php:90 #: src/Module/Settings/Channels.php:135 src/Module/Settings/Delegation.php:90
#: src/Module/Settings/Display.php:90 src/Module/Settings/Display.php:197 #: src/Module/Settings/Display.php:90 src/Module/Settings/Display.php:197
#: src/Module/Settings/Profile/Photo/Crop.php:165 #: src/Module/Settings/Profile/Photo/Crop.php:165
#: src/Module/Settings/Profile/Photo/Index.php:112 #: src/Module/Settings/Profile/Photo/Index.php:112
@ -382,7 +382,7 @@ msgstr ""
#: mod/notes.php:57 src/Content/Text/HTML.php:860 #: mod/notes.php:57 src/Content/Text/HTML.php:860
#: src/Module/Admin/Storage.php:142 src/Module/Filer/SaveTag.php:74 #: src/Module/Admin/Storage.php:142 src/Module/Filer/SaveTag.php:74
#: src/Module/Post/Edit.php:129 src/Module/Settings/Channels.php:213 #: src/Module/Post/Edit.php:129 src/Module/Settings/Channels.php:221
msgid "Save" msgid "Save"
msgstr "" msgstr ""
@ -794,12 +794,12 @@ msgstr ""
#: src/BaseModule.php:439 src/Content/Conversation/Factory/Channel.php:46 #: src/BaseModule.php:439 src/Content/Conversation/Factory/Channel.php:46
#: src/Content/Widget.php:239 src/Core/ACL.php:195 src/Module/Contact.php:414 #: src/Content/Widget.php:239 src/Core/ACL.php:195 src/Module/Contact.php:414
#: src/Module/PermissionTooltip.php:141 src/Module/PermissionTooltip.php:163 #: src/Module/PermissionTooltip.php:141 src/Module/PermissionTooltip.php:163
#: src/Module/Settings/Channels.php:148 #: src/Module/Settings/Channels.php:152
msgid "Followers" msgid "Followers"
msgstr "" msgstr ""
#: src/BaseModule.php:444 src/Content/Widget.php:240 src/Module/Contact.php:417 #: src/BaseModule.php:444 src/Content/Widget.php:240 src/Module/Contact.php:417
#: src/Module/Settings/Channels.php:147 #: src/Module/Settings/Channels.php:151
msgid "Following" msgid "Following"
msgstr "" msgstr ""
@ -1559,7 +1559,7 @@ msgid "Posts from accounts that are followed by accounts that you follow"
msgstr "" msgstr ""
#: src/Content/Conversation/Factory/Channel.php:48 #: src/Content/Conversation/Factory/Channel.php:48
#: src/Module/Settings/Channels.php:185 src/Module/Settings/Channels.php:204 #: src/Module/Settings/Channels.php:191 src/Module/Settings/Channels.php:212
msgid "Images" msgid "Images"
msgstr "" msgstr ""
@ -1568,7 +1568,7 @@ msgid "Posts with images"
msgstr "" msgstr ""
#: src/Content/Conversation/Factory/Channel.php:49 #: src/Content/Conversation/Factory/Channel.php:49
#: src/Module/Settings/Channels.php:187 src/Module/Settings/Channels.php:206 #: src/Module/Settings/Channels.php:193 src/Module/Settings/Channels.php:214
msgid "Audio" msgid "Audio"
msgstr "" msgstr ""
@ -1577,7 +1577,7 @@ msgid "Posts with audio"
msgstr "" msgstr ""
#: src/Content/Conversation/Factory/Channel.php:50 #: src/Content/Conversation/Factory/Channel.php:50
#: src/Module/Settings/Channels.php:186 src/Module/Settings/Channels.php:205 #: src/Module/Settings/Channels.php:192 src/Module/Settings/Channels.php:213
msgid "Videos" msgid "Videos"
msgstr "" msgstr ""
@ -1594,7 +1594,7 @@ msgid "Posts from local users on this server"
msgstr "" msgstr ""
#: src/Content/Conversation/Factory/Community.php:47 #: src/Content/Conversation/Factory/Community.php:47
#: src/Module/Settings/Channels.php:140 src/Module/Settings/Channels.php:145 #: src/Module/Settings/Channels.php:144 src/Module/Settings/Channels.php:149
msgid "Global Community" msgid "Global Community"
msgstr "" msgstr ""
@ -1854,8 +1854,8 @@ msgstr ""
msgid "Ignore %s server" msgid "Ignore %s server"
msgstr "" msgstr ""
#: src/Content/Item.php:443 src/Module/Settings/Channels.php:188 #: src/Content/Item.php:443 src/Module/Settings/Channels.php:194
#: src/Module/Settings/Channels.php:207 src/Object/Post.php:509 #: src/Module/Settings/Channels.php:215 src/Object/Post.php:509
msgid "Languages" msgid "Languages"
msgstr "" msgstr ""
@ -2058,7 +2058,7 @@ msgstr ""
msgid "Terms of Service of this Friendica instance" msgid "Terms of Service of this Friendica instance"
msgstr "" msgstr ""
#: src/Content/Nav.php:306 src/Module/Settings/Channels.php:146 #: src/Content/Nav.php:306 src/Module/Settings/Channels.php:150
#: view/theme/frio/theme.php:239 #: view/theme/frio/theme.php:239
msgid "Network" msgid "Network"
msgstr "" msgstr ""
@ -2385,7 +2385,7 @@ msgid "All"
msgstr "" msgstr ""
#: src/Content/Widget.php:592 src/Module/Admin/Site.php:472 #: src/Content/Widget.php:592 src/Module/Admin/Site.php:472
#: src/Module/BaseSettings.php:125 src/Module/Settings/Channels.php:209 #: src/Module/BaseSettings.php:125 src/Module/Settings/Channels.php:217
#: src/Module/Settings/Display.php:315 #: src/Module/Settings/Display.php:315
msgid "Channels" msgid "Channels"
msgstr "" msgstr ""
@ -6171,7 +6171,7 @@ msgstr ""
#: src/Module/Moderation/Blocklist/Server/Index.php:116 #: src/Module/Moderation/Blocklist/Server/Index.php:116
#: src/Module/Moderation/Item/Delete.php:67 src/Module/Register.php:148 #: src/Module/Moderation/Item/Delete.php:67 src/Module/Register.php:148
#: src/Module/Security/TwoFactor/Verify.php:101 #: src/Module/Security/TwoFactor/Verify.php:101
#: src/Module/Settings/Channels.php:178 src/Module/Settings/Channels.php:197 #: src/Module/Settings/Channels.php:182 src/Module/Settings/Channels.php:203
#: src/Module/Settings/TwoFactor/Index.php:161 #: src/Module/Settings/TwoFactor/Index.php:161
#: src/Module/Settings/TwoFactor/Verify.php:158 #: src/Module/Settings/TwoFactor/Verify.php:158
msgid "Required" msgid "Required"
@ -7424,7 +7424,7 @@ msgstr ""
#: src/Module/Friendica.php:102 #: src/Module/Friendica.php:102
#: src/Module/Moderation/Blocklist/Server/Index.php:87 #: src/Module/Moderation/Blocklist/Server/Index.php:87
#: src/Module/Moderation/Blocklist/Server/Index.php:111 #: src/Module/Moderation/Blocklist/Server/Index.php:111
#: src/Module/Settings/Channels.php:216 #: src/Module/Settings/Channels.php:224
msgid "Reason for the block" msgid "Reason for the block"
msgstr "" msgstr ""
@ -8172,7 +8172,7 @@ msgstr ""
#: src/Module/Moderation/Blocklist/Server/Index.php:86 #: src/Module/Moderation/Blocklist/Server/Index.php:86
#: src/Module/Moderation/Blocklist/Server/Index.php:110 #: src/Module/Moderation/Blocklist/Server/Index.php:110
#: src/Module/Settings/Channels.php:215 #: src/Module/Settings/Channels.php:223
msgid "Blocked server domain pattern" msgid "Blocked server domain pattern"
msgstr "" msgstr ""
@ -10154,100 +10154,120 @@ msgstr ""
msgid "No Addon settings configured" msgid "No Addon settings configured"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:138 #: src/Module/Settings/Channels.php:142
msgid "" msgid ""
"This page can be used to define the channels that will automatically be " "This page can be used to define the channels that will automatically be "
"reshared by your account." "reshared by your account."
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:143 #: src/Module/Settings/Channels.php:147
msgid "This page can be used to define your own channels." msgid "This page can be used to define your own channels."
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:170 #: src/Module/Settings/Channels.php:174
msgid "Publish" msgid "Publish"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:170 #: src/Module/Settings/Channels.php:174
msgid "" msgid ""
"When selected, the channel results are reshared. This only works for public " "When selected, the channel results are reshared. This only works for public "
"ActivityPub posts from the public timeline or the user defined circles." "ActivityPub posts from the public timeline or the user defined circles."
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:178 src/Module/Settings/Channels.php:197 #: src/Module/Settings/Channels.php:182 src/Module/Settings/Channels.php:203
#: src/Module/Settings/Display.php:338 #: src/Module/Settings/Display.php:338
msgid "Label" msgid "Label"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:179 src/Module/Settings/Channels.php:198 #: src/Module/Settings/Channels.php:183 src/Module/Settings/Channels.php:204
#: src/Module/Settings/Display.php:339 #: src/Module/Settings/Display.php:339
#: src/Module/Settings/TwoFactor/AppSpecific.php:137 #: src/Module/Settings/TwoFactor/AppSpecific.php:137
msgid "Description" msgid "Description"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:180 src/Module/Settings/Channels.php:199 #: src/Module/Settings/Channels.php:184 src/Module/Settings/Channels.php:205
msgid "Access Key" msgid "Access Key"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:181 src/Module/Settings/Channels.php:200 #: src/Module/Settings/Channels.php:185 src/Module/Settings/Channels.php:206
msgid "Circle/Channel" msgid "Circle/Channel"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:182 src/Module/Settings/Channels.php:201 #: src/Module/Settings/Channels.php:186 src/Module/Settings/Channels.php:207
msgid "Include Tags" msgid "Include Tags"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:183 src/Module/Settings/Channels.php:202 #: src/Module/Settings/Channels.php:187 src/Module/Settings/Channels.php:208
msgid "Exclude Tags" msgid "Exclude Tags"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:184 src/Module/Settings/Channels.php:203 #: src/Module/Settings/Channels.php:188 src/Module/Settings/Channels.php:209
msgid "Minimum Size"
msgstr ""
#: src/Module/Settings/Channels.php:189 src/Module/Settings/Channels.php:210
msgid "Maximum Size"
msgstr ""
#: src/Module/Settings/Channels.php:190 src/Module/Settings/Channels.php:211
msgid "Full Text Search" msgid "Full Text Search"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:188 src/Module/Settings/Channels.php:207 #: src/Module/Settings/Channels.php:194 src/Module/Settings/Channels.php:215
msgid "Select all languages that you want to see in this channel." msgid "Select all languages that you want to see in this channel."
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:190 #: src/Module/Settings/Channels.php:196
msgid "Delete channel" msgid "Delete channel"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:190 #: src/Module/Settings/Channels.php:196
msgid "Check to delete this entry from the channel list" msgid "Check to delete this entry from the channel list"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:197 #: src/Module/Settings/Channels.php:203
msgid "Short name for the channel. It is displayed on the channels widget." msgid "Short name for the channel. It is displayed on the channels widget."
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:198 #: src/Module/Settings/Channels.php:204
msgid "This should describe the content of the channel in a few word." msgid "This should describe the content of the channel in a few word."
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:199 #: src/Module/Settings/Channels.php:205
msgid "" msgid ""
"When you want to access this channel via an access key, you can define it " "When you want to access this channel via an access key, you can define it "
"here. Pay attention to not use an already used one." "here. Pay attention to not use an already used one."
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:200 #: src/Module/Settings/Channels.php:206
msgid "Select a circle or channel, that your channel should be based on." msgid "Select a circle or channel, that your channel should be based on."
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:201 #: src/Module/Settings/Channels.php:207
msgid "" msgid ""
"Comma separated list of tags. A post will be used when it contains any of " "Comma separated list of tags. A post will be used when it contains any of "
"the listed tags." "the listed tags."
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:202 #: src/Module/Settings/Channels.php:208
msgid "" msgid ""
"Comma separated list of tags. If a post contain any of these tags, then it " "Comma separated list of tags. If a post contain any of these tags, then it "
"will not be part of nthis channel." "will not be part of nthis channel."
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:203 #: src/Module/Settings/Channels.php:209
msgid ""
"Minimum post size. Leave empty for no minimum size. The size is calculated "
"without links, attached posts, mentions or hashtags."
msgstr ""
#: src/Module/Settings/Channels.php:210
msgid ""
"Maximum post size. Leave empty for no maximum size. The size is calculated "
"without links, attached posts, mentions or hashtags."
msgstr ""
#: src/Module/Settings/Channels.php:211
#, php-format #, php-format
msgid "" msgid ""
"Search terms for the body, supports the \"boolean mode\" operators from " "Search terms for the body, supports the \"boolean mode\" operators from "
@ -10255,35 +10275,35 @@ msgid ""
"keywords: %s" "keywords: %s"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:204 #: src/Module/Settings/Channels.php:212
msgid "Check to display images in the channel." msgid "Check to display images in the channel."
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:205 #: src/Module/Settings/Channels.php:213
msgid "Check to display videos in the channel." msgid "Check to display videos in the channel."
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:206 #: src/Module/Settings/Channels.php:214
msgid "Check to display audio in the channel." msgid "Check to display audio in the channel."
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:211 #: src/Module/Settings/Channels.php:219
msgid "Add new entry to the channel list" msgid "Add new entry to the channel list"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:212 #: src/Module/Settings/Channels.php:220
msgid "Add" msgid "Add"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:214 #: src/Module/Settings/Channels.php:222
msgid "Current Entries in the channel list" msgid "Current Entries in the channel list"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:217 #: src/Module/Settings/Channels.php:225
msgid "Delete entry from the channel list" msgid "Delete entry from the channel list"
msgstr "" msgstr ""
#: src/Module/Settings/Channels.php:218 #: src/Module/Settings/Channels.php:226
msgid "Delete entry from the channel list?" msgid "Delete entry from the channel list?"
msgstr "" msgstr ""

View file

@ -11,6 +11,8 @@
{{include file="field_textarea.tpl" field=$include_tags}} {{include file="field_textarea.tpl" field=$include_tags}}
{{include file="field_textarea.tpl" field=$exclude_tags}} {{include file="field_textarea.tpl" field=$exclude_tags}}
{{include file="field_textarea.tpl" field=$text_search}} {{include file="field_textarea.tpl" field=$text_search}}
{{include file="field_input.tpl" field=$min_size}}
{{include file="field_input.tpl" field=$max_size}}
{{include file="field_checkbox.tpl" field=$image}} {{include file="field_checkbox.tpl" field=$image}}
{{include file="field_checkbox.tpl" field=$video}} {{include file="field_checkbox.tpl" field=$video}}
{{include file="field_checkbox.tpl" field=$audio}} {{include file="field_checkbox.tpl" field=$audio}}
@ -31,6 +33,8 @@
{{include file="field_select.tpl" field=$e.circle}} {{include file="field_select.tpl" field=$e.circle}}
{{include file="field_textarea.tpl" field=$e.include_tags}} {{include file="field_textarea.tpl" field=$e.include_tags}}
{{include file="field_textarea.tpl" field=$e.exclude_tags}} {{include file="field_textarea.tpl" field=$e.exclude_tags}}
{{include file="field_input.tpl" field=$e.min_size}}
{{include file="field_input.tpl" field=$e.max_size}}
{{include file="field_textarea.tpl" field=$e.text_search}} {{include file="field_textarea.tpl" field=$e.text_search}}
{{include file="field_checkbox.tpl" field=$e.image}} {{include file="field_checkbox.tpl" field=$e.image}}
{{include file="field_checkbox.tpl" field=$e.video}} {{include file="field_checkbox.tpl" field=$e.video}}

View file

@ -18,6 +18,8 @@
{{include file="field_select.tpl" field=$circle}} {{include file="field_select.tpl" field=$circle}}
{{include file="field_textarea.tpl" field=$include_tags}} {{include file="field_textarea.tpl" field=$include_tags}}
{{include file="field_textarea.tpl" field=$exclude_tags}} {{include file="field_textarea.tpl" field=$exclude_tags}}
{{include file="field_input.tpl" field=$min_size}}
{{include file="field_input.tpl" field=$max_size}}
{{include file="field_textarea.tpl" field=$text_search}} {{include file="field_textarea.tpl" field=$text_search}}
{{include file="field_checkbox.tpl" field=$image}} {{include file="field_checkbox.tpl" field=$image}}
{{include file="field_checkbox.tpl" field=$video}} {{include file="field_checkbox.tpl" field=$video}}
@ -48,6 +50,8 @@
{{include file="field_select.tpl" field=$e.circle}} {{include file="field_select.tpl" field=$e.circle}}
{{include file="field_textarea.tpl" field=$e.include_tags}} {{include file="field_textarea.tpl" field=$e.include_tags}}
{{include file="field_textarea.tpl" field=$e.exclude_tags}} {{include file="field_textarea.tpl" field=$e.exclude_tags}}
{{include file="field_input.tpl" field=$e.min_size}}
{{include file="field_input.tpl" field=$e.max_size}}
{{include file="field_textarea.tpl" field=$e.text_search}} {{include file="field_textarea.tpl" field=$e.text_search}}
{{include file="field_checkbox.tpl" field=$e.image}} {{include file="field_checkbox.tpl" field=$e.image}}
{{include file="field_checkbox.tpl" field=$e.video}} {{include file="field_checkbox.tpl" field=$e.video}}