diff --git a/database.sql b/database.sql index 128323fcea..16e3b7af98 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2024.09-rc (Yellow Archangel) --- DB_UPDATE_VERSION 1573 +-- DB_UPDATE_VERSION 1574 -- ------------------------------------------ @@ -2163,7 +2163,10 @@ CREATE VIEW `post-timeline-view` AS SELECT `owner`.`gsid` AS `owner-gsid`, `post-user`.`causer-id` AS `causer-id`, `causer`.`blocked` AS `causer-blocked`, - `causer`.`gsid` AS `causer-gsid` + `causer`.`gsid` AS `causer-gsid`, + `post-thread-user`.`network` AS `parent-network`, + `post-thread-user`.`owner-id` AS `parent-owner-id`, + `post-thread-user`.`author-id` AS `parent-author-id` FROM `post-user` LEFT JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid` STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id` @@ -2414,6 +2417,7 @@ CREATE VIEW `post-origin-view` AS SELECT `diaspora-interaction`.`interaction` AS `signed_text`, `parent-item-uri`.`guid` AS `parent-guid`, `post-thread-user`.`network` AS `parent-network`, + `post-thread-user`.`owner-id` AS `parent-owner-id`, `post-thread-user`.`author-id` AS `parent-author-id`, `parent-post-author`.`url` AS `parent-author-link`, `parent-post-author`.`name` AS `parent-author-name`, @@ -2607,6 +2611,7 @@ CREATE VIEW `post-thread-origin-view` AS SELECT `diaspora-interaction`.`interaction` AS `signed_text`, `parent-item-uri`.`guid` AS `parent-guid`, `post-thread-user`.`network` AS `parent-network`, + `post-thread-user`.`owner-id` AS `parent-owner-id`, `post-thread-user`.`author-id` AS `parent-author-id`, `author`.`url` AS `parent-author-link`, `author`.`name` AS `parent-author-name`, @@ -2800,6 +2805,7 @@ CREATE VIEW `post-user-view` AS SELECT `diaspora-interaction`.`interaction` AS `signed_text`, `parent-item-uri`.`guid` AS `parent-guid`, `post-thread-user`.`network` AS `parent-network`, + `post-thread-user`.`owner-id` AS `parent-owner-id`, `post-thread-user`.`author-id` AS `parent-author-id`, `parent-post-author`.`url` AS `parent-author-link`, `parent-post-author`.`name` AS `parent-author-name`, @@ -2992,6 +2998,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT `diaspora-interaction`.`interaction` AS `signed_text`, `parent-item-uri`.`guid` AS `parent-guid`, `post-thread-user`.`network` AS `parent-network`, + `post-thread-user`.`owner-id` AS `parent-owner-id`, `post-thread-user`.`author-id` AS `parent-author-id`, `author`.`url` AS `parent-author-link`, `author`.`name` AS `parent-author-name`, @@ -3148,6 +3155,7 @@ CREATE VIEW `post-view` AS SELECT `diaspora-interaction`.`interaction` AS `signed_text`, `parent-item-uri`.`guid` AS `parent-guid`, `post-thread`.`network` AS `parent-network`, + `post-thread`.`owner-id` AS `parent-owner-id`, `post-thread`.`author-id` AS `parent-author-id`, `parent-post-author`.`url` AS `parent-author-link`, `parent-post-author`.`name` AS `parent-author-name`, @@ -3303,6 +3311,7 @@ CREATE VIEW `post-thread-view` AS SELECT `diaspora-interaction`.`interaction` AS `signed_text`, `parent-item-uri`.`guid` AS `parent-guid`, `post-thread`.`network` AS `parent-network`, + `post-thread`.`owner-id` AS `parent-owner-id`, `post-thread`.`author-id` AS `parent-author-id`, `author`.`url` AS `parent-author-link`, `author`.`name` AS `parent-author-name`, diff --git a/src/Module/Api/Mastodon/Timelines/Home.php b/src/Module/Api/Mastodon/Timelines/Home.php index 9c13bb5cce..5d72b38ca9 100644 --- a/src/Module/Api/Mastodon/Timelines/Home.php +++ b/src/Module/Api/Mastodon/Timelines/Home.php @@ -66,6 +66,8 @@ class Home extends BaseApi $condition = DBA::mergeConditions($condition, ['gravity' => Item::GRAVITY_PARENT]); } + $condition = DBA::mergeConditions($condition, ["NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` IN (`parent-owner-id`, `parent-author-id`) AND (`blocked` OR `ignored` OR `channel-only`))", $uid]); + $items = Post::selectTimelineForUser($uid, ['uri-id'], $condition, $params); $display_quotes = self::appSupportsQuotes(); diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 7399a6268d..5956b5458c 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -44,7 +44,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', 1573); + define('DB_UPDATE_VERSION', 1574); } return [ diff --git a/static/dbview.config.php b/static/dbview.config.php index f5b2931897..6a944d7188 100644 --- a/static/dbview.config.php +++ b/static/dbview.config.php @@ -24,7 +24,7 @@ * */ - return [ +return [ "application-view" => [ "fields" => [ "id" => ["application", "id"], @@ -153,6 +153,9 @@ "causer-id" => ["post-user", "causer-id"], "causer-blocked" => ["causer", "blocked"], "causer-gsid" => ["causer", "gsid"], + "parent-network" => ["post-thread-user", "network"], + "parent-owner-id" => ["post-thread-user", "owner-id"], + "parent-author-id" => ["post-thread-user", "author-id"], ], "query" => "FROM `post-user` LEFT JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid` @@ -397,6 +400,7 @@ "signed_text" => ["diaspora-interaction", "interaction"], "parent-guid" => ["parent-item-uri", "guid"], "parent-network" => ["post-thread-user", "network"], + "parent-owner-id" => ["post-thread-user", "owner-id"], "parent-author-id" => ["post-thread-user", "author-id"], "parent-author-link" => ["parent-post-author", "url"], "parent-author-name" => ["parent-post-author", "name"], @@ -588,6 +592,7 @@ "signed_text" => ["diaspora-interaction", "interaction"], "parent-guid" => ["parent-item-uri", "guid"], "parent-network" => ["post-thread-user", "network"], + "parent-owner-id" => ["post-thread-user", "owner-id"], "parent-author-id" => ["post-thread-user", "author-id"], "parent-author-link" => ["author", "url"], "parent-author-name" => ["author", "name"], @@ -779,6 +784,7 @@ "signed_text" => ["diaspora-interaction", "interaction"], "parent-guid" => ["parent-item-uri", "guid"], "parent-network" => ["post-thread-user", "network"], + "parent-owner-id" => ["post-thread-user", "owner-id"], "parent-author-id" => ["post-thread-user", "author-id"], "parent-author-link" => ["parent-post-author", "url"], "parent-author-name" => ["parent-post-author", "name"], @@ -969,6 +975,7 @@ "signed_text" => ["diaspora-interaction", "interaction"], "parent-guid" => ["parent-item-uri", "guid"], "parent-network" => ["post-thread-user", "network"], + "parent-owner-id" => ["post-thread-user", "owner-id"], "parent-author-id" => ["post-thread-user", "author-id"], "parent-author-link" => ["author", "url"], "parent-author-name" => ["author", "name"], @@ -1123,6 +1130,7 @@ "signed_text" => ["diaspora-interaction", "interaction"], "parent-guid" => ["parent-item-uri", "guid"], "parent-network" => ["post-thread", "network"], + "parent-owner-id" => ["post-thread", "owner-id"], "parent-author-id" => ["post-thread", "author-id"], "parent-author-link" => ["parent-post-author", "url"], "parent-author-name" => ["parent-post-author", "name"], @@ -1276,6 +1284,7 @@ "signed_text" => ["diaspora-interaction", "interaction"], "parent-guid" => ["parent-item-uri", "guid"], "parent-network" => ["post-thread", "network"], + "parent-owner-id" => ["post-thread", "owner-id"], "parent-author-id" => ["post-thread", "author-id"], "parent-author-link" => ["author", "url"], "parent-author-name" => ["author", "name"], @@ -1783,7 +1792,7 @@ "label" => ["profile_field", "label"], "value" => ["profile_field", "value"], "order" => ["profile_field", "order"], - "psid"=> ["profile_field", "psid"], + "psid" => ["profile_field", "psid"], "allow_cid" => ["permissionset", "allow_cid"], "allow_gid" => ["permissionset", "allow_gid"], "deny_cid" => ["permissionset", "deny_cid"],