]> git.mxchange.org Git - friendica.git/commitdiff
Issue 13909: Filter channels by network (#13924)
authorMichael Vogel <icarus@dabo.de>
Tue, 20 Feb 2024 06:11:26 +0000 (07:11 +0100)
committerGitHub <noreply@github.com>
Tue, 20 Feb 2024 06:11:26 +0000 (07:11 +0100)
database.sql
doc/database/db_post-engagement.md
src/Model/Post/Engagement.php
src/Module/Conversation/Network.php
src/Module/Conversation/Timeline.php
static/dbstructure.config.php
static/dbview.config.php
update.php

index 41ce810cf51e695eeb8866517d2bf35a2178e0b1..3ffb6ad07c85ca2e59041590d7b69bb04f8d253b 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- 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',
        `size` int unsigned COMMENT 'Body size',
        `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',
        `comments` mediumint unsigned COMMENT 'Number of comments',
        `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`.`received` AS `received`,
        `post-thread-user`.`created` AS `created`,
+       `post-thread-user`.`network` AS `network`,
        `post-searchindex`.`language` AS `restricted`,
        0 AS `comments`,
        0 AS `activities`
index c82c62b863cdf1e37cee208c5a9c3c3ec81ff257..32f3ce76b68a9025d1f4fcf22d5b5169f438136f 100644 (file)
@@ -16,6 +16,7 @@ Fields
 | searchtext   | Simplified text for the full text search                              | mediumtext         | YES  |     | NULL    |       |
 | size         | Body size                                                             | int unsigned       | 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       |       |
 | comments     | Number of comments                                                    | mediumint unsigned | YES  |     | NULL    |       |
 | activities   | Number of activities (like, dislike, ...)                             | mediumint unsigned | YES  |     | NULL    |       |
index 99940a784d8dac3d3ff14b02c9124580ba295a4b..f37aa3571c2ac303ee7719fc1a780a826f204ba4 100644 (file)
@@ -118,6 +118,7 @@ class Engagement
                        'searchtext'   => $searchtext,
                        'size'         => self::getContentSize($parent),
                        'created'      => $parent['created'],
+                       'network'      => $parent['network'],
                        '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]),
                        'activities'   => DBA::count('post', [
index 9f5c04145619b6a136721de959a6de6eb0d134e2..0a9d5e33b64a605b5922026b7001592f066c534b 100644 (file)
@@ -65,8 +65,6 @@ class Network extends Timeline
        /** @var int */
        protected $circleId;
        /** @var string */
-       protected $network;
-       /** @var string */
        protected $dateFrom;
        /** @var string */
        protected $dateTo;
index 020c10272d07c7706acecc1db6f1b836b53a8418..d77e78fc5b2a8a5bee654474748df47189750b7b 100644 (file)
@@ -74,6 +74,8 @@ class Timeline extends BaseModule
        protected $raw;
        /** @var string */
        protected $order;
+       /** @var string */
+       protected $network;
 
        /** @var App\Mode $mode */
        protected $mode;
@@ -372,6 +374,10 @@ class Timeline extends BaseModule
 
                $this->setMaxMinByOrder($request);
 
+               if (!empty($this->network)) {
+                       $condition = DBA::mergeConditions($condition, ['network' => $this->network]);
+               }
+
                if (($this->selectedTab != ChannelEntity::LANGUAGE) && !is_numeric($this->selectedTab)) {
                        $condition = $this->addLanguageCondition($uid, $condition);
                }
index 7606d7b65f75e313590a72caf8be21db81d9c921..98567bbbceee34fc8325690266f3ba9a8926c715 100644 (file)
@@ -56,7 +56,7 @@ use Friendica\Database\DBA;
 
 // This file is required several times during the test in DbaDefinition which justifies this condition
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1553);
+       define('DB_UPDATE_VERSION', 1554);
 }
 
 return [
@@ -1373,6 +1373,7 @@ return [
                        "searchtext" => ["type" => "mediumtext", "comment" => "Simplified text for the full text search"],
                        "size" => ["type" => "int unsigned", "comment" => "Body size"],
                        "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"],
                        "comments" => ["type" => "mediumint unsigned", "comment" => "Number of comments"],
                        "activities" => ["type" => "mediumint unsigned", "comment" => "Number of activities (like, dislike, ...)"],
index 99f9132ff37e95fc6fb70794c9c62cbb0dc62582..7ce0fca393003cac5014527b1ff0a4ac2cbfc13b 100644 (file)
                        "commented" => ["post-thread-user", "commented"],
                        "received" => ["post-thread-user", "received"],
                        "created" => ["post-thread-user", "created"],
+                       "network" => ["post-thread-user", "network"],
                        "restricted" => ["post-searchindex", "language"],
                        "comments" => "0",
                        "activities" => "0",
index c19bbed3889ff21795869e990dbf4484993d460e..7329b84b8db3b3d9d864d451324dfda94d60e047 100644 (file)
@@ -1429,3 +1429,10 @@ function update_1552()
 
        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;
+}