Issue 13909: Filter channels by network (#13924)
This commit is contained in:
parent
d95c9d28a8
commit
71384e6f39
|
@ -1,6 +1,6 @@
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
-- Friendica 2024.03-rc (Yellow Archangel)
|
-- Friendica 2024.03-rc (Yellow Archangel)
|
||||||
-- DB_UPDATE_VERSION 1553
|
-- DB_UPDATE_VERSION 1554
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -1352,6 +1352,7 @@ CREATE TABLE IF NOT EXISTS `post-engagement` (
|
||||||
`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',
|
`size` int unsigned COMMENT 'Body size',
|
||||||
`created` datetime COMMENT '',
|
`created` datetime COMMENT '',
|
||||||
|
`network` char(4) 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',
|
||||||
`activities` mediumint unsigned COMMENT 'Number of activities (like, dislike, ...)',
|
`activities` mediumint unsigned COMMENT 'Number of activities (like, dislike, ...)',
|
||||||
|
@ -2123,6 +2124,7 @@ CREATE VIEW `post-searchindex-user-view` AS SELECT
|
||||||
`post-thread-user`.`commented` AS `commented`,
|
`post-thread-user`.`commented` AS `commented`,
|
||||||
`post-thread-user`.`received` AS `received`,
|
`post-thread-user`.`received` AS `received`,
|
||||||
`post-thread-user`.`created` AS `created`,
|
`post-thread-user`.`created` AS `created`,
|
||||||
|
`post-thread-user`.`network` AS `network`,
|
||||||
`post-searchindex`.`language` AS `restricted`,
|
`post-searchindex`.`language` AS `restricted`,
|
||||||
0 AS `comments`,
|
0 AS `comments`,
|
||||||
0 AS `activities`
|
0 AS `activities`
|
||||||
|
|
|
@ -16,6 +16,7 @@ Fields
|
||||||
| 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 | |
|
| size | Body size | int unsigned | YES | | NULL | |
|
||||||
| created | | datetime | YES | | NULL | |
|
| created | | datetime | YES | | NULL | |
|
||||||
|
| network | | char(4) | 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 | |
|
||||||
| activities | Number of activities (like, dislike, ...) | mediumint unsigned | YES | | NULL | |
|
| activities | Number of activities (like, dislike, ...) | mediumint unsigned | YES | | NULL | |
|
||||||
|
|
|
@ -118,6 +118,7 @@ class Engagement
|
||||||
'searchtext' => $searchtext,
|
'searchtext' => $searchtext,
|
||||||
'size' => self::getContentSize($parent),
|
'size' => self::getContentSize($parent),
|
||||||
'created' => $parent['created'],
|
'created' => $parent['created'],
|
||||||
|
'network' => $parent['network'],
|
||||||
'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]),
|
||||||
'activities' => DBA::count('post', [
|
'activities' => DBA::count('post', [
|
||||||
|
|
|
@ -65,8 +65,6 @@ class Network extends Timeline
|
||||||
/** @var int */
|
/** @var int */
|
||||||
protected $circleId;
|
protected $circleId;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $network;
|
|
||||||
/** @var string */
|
|
||||||
protected $dateFrom;
|
protected $dateFrom;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $dateTo;
|
protected $dateTo;
|
||||||
|
|
|
@ -74,6 +74,8 @@ class Timeline extends BaseModule
|
||||||
protected $raw;
|
protected $raw;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $order;
|
protected $order;
|
||||||
|
/** @var string */
|
||||||
|
protected $network;
|
||||||
|
|
||||||
/** @var App\Mode $mode */
|
/** @var App\Mode $mode */
|
||||||
protected $mode;
|
protected $mode;
|
||||||
|
@ -372,6 +374,10 @@ class Timeline extends BaseModule
|
||||||
|
|
||||||
$this->setMaxMinByOrder($request);
|
$this->setMaxMinByOrder($request);
|
||||||
|
|
||||||
|
if (!empty($this->network)) {
|
||||||
|
$condition = DBA::mergeConditions($condition, ['network' => $this->network]);
|
||||||
|
}
|
||||||
|
|
||||||
if (($this->selectedTab != ChannelEntity::LANGUAGE) && !is_numeric($this->selectedTab)) {
|
if (($this->selectedTab != ChannelEntity::LANGUAGE) && !is_numeric($this->selectedTab)) {
|
||||||
$condition = $this->addLanguageCondition($uid, $condition);
|
$condition = $this->addLanguageCondition($uid, $condition);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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', 1553);
|
define('DB_UPDATE_VERSION', 1554);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -1373,6 +1373,7 @@ return [
|
||||||
"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"],
|
"size" => ["type" => "int unsigned", "comment" => "Body size"],
|
||||||
"created" => ["type" => "datetime", "comment" => ""],
|
"created" => ["type" => "datetime", "comment" => ""],
|
||||||
|
"network" => ["type" => "char(4)", "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"],
|
||||||
"activities" => ["type" => "mediumint unsigned", "comment" => "Number of activities (like, dislike, ...)"],
|
"activities" => ["type" => "mediumint unsigned", "comment" => "Number of activities (like, dislike, ...)"],
|
||||||
|
|
|
@ -154,6 +154,7 @@
|
||||||
"commented" => ["post-thread-user", "commented"],
|
"commented" => ["post-thread-user", "commented"],
|
||||||
"received" => ["post-thread-user", "received"],
|
"received" => ["post-thread-user", "received"],
|
||||||
"created" => ["post-thread-user", "created"],
|
"created" => ["post-thread-user", "created"],
|
||||||
|
"network" => ["post-thread-user", "network"],
|
||||||
"restricted" => ["post-searchindex", "language"],
|
"restricted" => ["post-searchindex", "language"],
|
||||||
"comments" => "0",
|
"comments" => "0",
|
||||||
"activities" => "0",
|
"activities" => "0",
|
||||||
|
|
|
@ -1429,3 +1429,10 @@ function update_1552()
|
||||||
|
|
||||||
return Update::SUCCESS;
|
return Update::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_1554()
|
||||||
|
{
|
||||||
|
DBA::e("UPDATE `post-engagement` INNER JOIN `post` ON `post`.`uri-id` = `post-engagement`.`uri-id` SET `post-engagement`.`network` = `post`.`network`");
|
||||||
|
|
||||||
|
return Update::SUCCESS;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user