Merge pull request #14477 from annando/issue-14212

Issue 14212: exclude channel only posts from the API timeline
This commit is contained in:
Tobias Diekershoff 2024-10-19 22:07:46 +02:00 committed by GitHub
commit 7e84699bdd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 25 additions and 5 deletions

View file

@ -1,6 +1,6 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 2024.09-rc (Yellow Archangel) -- 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`, `owner`.`gsid` AS `owner-gsid`,
`post-user`.`causer-id` AS `causer-id`, `post-user`.`causer-id` AS `causer-id`,
`causer`.`blocked` AS `causer-blocked`, `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` 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` 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` 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`, `diaspora-interaction`.`interaction` AS `signed_text`,
`parent-item-uri`.`guid` AS `parent-guid`, `parent-item-uri`.`guid` AS `parent-guid`,
`post-thread-user`.`network` AS `parent-network`, `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`, `post-thread-user`.`author-id` AS `parent-author-id`,
`parent-post-author`.`url` AS `parent-author-link`, `parent-post-author`.`url` AS `parent-author-link`,
`parent-post-author`.`name` AS `parent-author-name`, `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`, `diaspora-interaction`.`interaction` AS `signed_text`,
`parent-item-uri`.`guid` AS `parent-guid`, `parent-item-uri`.`guid` AS `parent-guid`,
`post-thread-user`.`network` AS `parent-network`, `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`, `post-thread-user`.`author-id` AS `parent-author-id`,
`author`.`url` AS `parent-author-link`, `author`.`url` AS `parent-author-link`,
`author`.`name` AS `parent-author-name`, `author`.`name` AS `parent-author-name`,
@ -2800,6 +2805,7 @@ CREATE VIEW `post-user-view` AS SELECT
`diaspora-interaction`.`interaction` AS `signed_text`, `diaspora-interaction`.`interaction` AS `signed_text`,
`parent-item-uri`.`guid` AS `parent-guid`, `parent-item-uri`.`guid` AS `parent-guid`,
`post-thread-user`.`network` AS `parent-network`, `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`, `post-thread-user`.`author-id` AS `parent-author-id`,
`parent-post-author`.`url` AS `parent-author-link`, `parent-post-author`.`url` AS `parent-author-link`,
`parent-post-author`.`name` AS `parent-author-name`, `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`, `diaspora-interaction`.`interaction` AS `signed_text`,
`parent-item-uri`.`guid` AS `parent-guid`, `parent-item-uri`.`guid` AS `parent-guid`,
`post-thread-user`.`network` AS `parent-network`, `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`, `post-thread-user`.`author-id` AS `parent-author-id`,
`author`.`url` AS `parent-author-link`, `author`.`url` AS `parent-author-link`,
`author`.`name` AS `parent-author-name`, `author`.`name` AS `parent-author-name`,
@ -3148,6 +3155,7 @@ CREATE VIEW `post-view` AS SELECT
`diaspora-interaction`.`interaction` AS `signed_text`, `diaspora-interaction`.`interaction` AS `signed_text`,
`parent-item-uri`.`guid` AS `parent-guid`, `parent-item-uri`.`guid` AS `parent-guid`,
`post-thread`.`network` AS `parent-network`, `post-thread`.`network` AS `parent-network`,
`post-thread`.`owner-id` AS `parent-owner-id`,
`post-thread`.`author-id` AS `parent-author-id`, `post-thread`.`author-id` AS `parent-author-id`,
`parent-post-author`.`url` AS `parent-author-link`, `parent-post-author`.`url` AS `parent-author-link`,
`parent-post-author`.`name` AS `parent-author-name`, `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`, `diaspora-interaction`.`interaction` AS `signed_text`,
`parent-item-uri`.`guid` AS `parent-guid`, `parent-item-uri`.`guid` AS `parent-guid`,
`post-thread`.`network` AS `parent-network`, `post-thread`.`network` AS `parent-network`,
`post-thread`.`owner-id` AS `parent-owner-id`,
`post-thread`.`author-id` AS `parent-author-id`, `post-thread`.`author-id` AS `parent-author-id`,
`author`.`url` AS `parent-author-link`, `author`.`url` AS `parent-author-link`,
`author`.`name` AS `parent-author-name`, `author`.`name` AS `parent-author-name`,

View file

@ -66,6 +66,8 @@ class Home extends BaseApi
$condition = DBA::mergeConditions($condition, ['gravity' => Item::GRAVITY_PARENT]); $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); $items = Post::selectTimelineForUser($uid, ['uri-id'], $condition, $params);
$display_quotes = self::appSupportsQuotes(); $display_quotes = self::appSupportsQuotes();

View file

@ -44,7 +44,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', 1573); define('DB_UPDATE_VERSION', 1574);
} }
return [ return [

View file

@ -153,6 +153,9 @@
"causer-id" => ["post-user", "causer-id"], "causer-id" => ["post-user", "causer-id"],
"causer-blocked" => ["causer", "blocked"], "causer-blocked" => ["causer", "blocked"],
"causer-gsid" => ["causer", "gsid"], "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` "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` 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"], "signed_text" => ["diaspora-interaction", "interaction"],
"parent-guid" => ["parent-item-uri", "guid"], "parent-guid" => ["parent-item-uri", "guid"],
"parent-network" => ["post-thread-user", "network"], "parent-network" => ["post-thread-user", "network"],
"parent-owner-id" => ["post-thread-user", "owner-id"],
"parent-author-id" => ["post-thread-user", "author-id"], "parent-author-id" => ["post-thread-user", "author-id"],
"parent-author-link" => ["parent-post-author", "url"], "parent-author-link" => ["parent-post-author", "url"],
"parent-author-name" => ["parent-post-author", "name"], "parent-author-name" => ["parent-post-author", "name"],
@ -588,6 +592,7 @@
"signed_text" => ["diaspora-interaction", "interaction"], "signed_text" => ["diaspora-interaction", "interaction"],
"parent-guid" => ["parent-item-uri", "guid"], "parent-guid" => ["parent-item-uri", "guid"],
"parent-network" => ["post-thread-user", "network"], "parent-network" => ["post-thread-user", "network"],
"parent-owner-id" => ["post-thread-user", "owner-id"],
"parent-author-id" => ["post-thread-user", "author-id"], "parent-author-id" => ["post-thread-user", "author-id"],
"parent-author-link" => ["author", "url"], "parent-author-link" => ["author", "url"],
"parent-author-name" => ["author", "name"], "parent-author-name" => ["author", "name"],
@ -779,6 +784,7 @@
"signed_text" => ["diaspora-interaction", "interaction"], "signed_text" => ["diaspora-interaction", "interaction"],
"parent-guid" => ["parent-item-uri", "guid"], "parent-guid" => ["parent-item-uri", "guid"],
"parent-network" => ["post-thread-user", "network"], "parent-network" => ["post-thread-user", "network"],
"parent-owner-id" => ["post-thread-user", "owner-id"],
"parent-author-id" => ["post-thread-user", "author-id"], "parent-author-id" => ["post-thread-user", "author-id"],
"parent-author-link" => ["parent-post-author", "url"], "parent-author-link" => ["parent-post-author", "url"],
"parent-author-name" => ["parent-post-author", "name"], "parent-author-name" => ["parent-post-author", "name"],
@ -969,6 +975,7 @@
"signed_text" => ["diaspora-interaction", "interaction"], "signed_text" => ["diaspora-interaction", "interaction"],
"parent-guid" => ["parent-item-uri", "guid"], "parent-guid" => ["parent-item-uri", "guid"],
"parent-network" => ["post-thread-user", "network"], "parent-network" => ["post-thread-user", "network"],
"parent-owner-id" => ["post-thread-user", "owner-id"],
"parent-author-id" => ["post-thread-user", "author-id"], "parent-author-id" => ["post-thread-user", "author-id"],
"parent-author-link" => ["author", "url"], "parent-author-link" => ["author", "url"],
"parent-author-name" => ["author", "name"], "parent-author-name" => ["author", "name"],
@ -1123,6 +1130,7 @@
"signed_text" => ["diaspora-interaction", "interaction"], "signed_text" => ["diaspora-interaction", "interaction"],
"parent-guid" => ["parent-item-uri", "guid"], "parent-guid" => ["parent-item-uri", "guid"],
"parent-network" => ["post-thread", "network"], "parent-network" => ["post-thread", "network"],
"parent-owner-id" => ["post-thread", "owner-id"],
"parent-author-id" => ["post-thread", "author-id"], "parent-author-id" => ["post-thread", "author-id"],
"parent-author-link" => ["parent-post-author", "url"], "parent-author-link" => ["parent-post-author", "url"],
"parent-author-name" => ["parent-post-author", "name"], "parent-author-name" => ["parent-post-author", "name"],
@ -1276,6 +1284,7 @@
"signed_text" => ["diaspora-interaction", "interaction"], "signed_text" => ["diaspora-interaction", "interaction"],
"parent-guid" => ["parent-item-uri", "guid"], "parent-guid" => ["parent-item-uri", "guid"],
"parent-network" => ["post-thread", "network"], "parent-network" => ["post-thread", "network"],
"parent-owner-id" => ["post-thread", "owner-id"],
"parent-author-id" => ["post-thread", "author-id"], "parent-author-id" => ["post-thread", "author-id"],
"parent-author-link" => ["author", "url"], "parent-author-link" => ["author", "url"],
"parent-author-name" => ["author", "name"], "parent-author-name" => ["author", "name"],