From: Hank Grabowski Date: Thu, 16 Feb 2023 13:08:58 +0000 (-0500) Subject: Add blocked/ignored filters to Mastodon Timeline API Direct and List endpoints X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a4515daca4980377c56cd12d56a12cf505dc57bf;p=friendica.git Add blocked/ignored filters to Mastodon Timeline API Direct and List endpoints --- diff --git a/src/Module/Api/Mastodon/Timelines/Direct.php b/src/Module/Api/Mastodon/Timelines/Direct.php index a5f1f97f32..82b96e698f 100644 --- a/src/Module/Api/Mastodon/Timelines/Direct.php +++ b/src/Module/Api/Mastodon/Timelines/Direct.php @@ -65,6 +65,13 @@ class Direct extends BaseApi $params['order'] = ['uri-id']; } + if (!empty($uid)) { + $condition = DBA::mergeConditions( + $condition, + ["NOT `parent-author-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND (`blocked` OR `ignored`) AND `cid` = `parent-author-id`)", $uid] + ); + } + $mails = DBA::select('mail', ['id', 'uri-id'], $condition, $params); $statuses = []; diff --git a/src/Module/Api/Mastodon/Timelines/ListTimeline.php b/src/Module/Api/Mastodon/Timelines/ListTimeline.php index a8de13056e..378e3eeaaf 100644 --- a/src/Module/Api/Mastodon/Timelines/ListTimeline.php +++ b/src/Module/Api/Mastodon/Timelines/ListTimeline.php @@ -95,6 +95,13 @@ class ListTimeline extends BaseApi $condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin` AND `post-user`.`uri-id` = `post-user-view`.`uri-id`)"]); } + if (!empty($uid)) { + $condition = DBA::mergeConditions( + $condition, + ["NOT `parent-author-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND (`blocked` OR `ignored`) AND `cid` = `parent-author-id`)", $uid] + ); + } + $items = Post::selectForUser($uid, ['uri-id'], $condition, $params); $display_quotes = self::appSupportsQuotes();