]> git.mxchange.org Git - friendica.git/commitdiff
Add blocked/ignored filters to Mastodon Timeline API Direct and List endpoints
authorHank Grabowski <hankgrabowski@gmail.com>
Thu, 16 Feb 2023 13:08:58 +0000 (08:08 -0500)
committerHank Grabowski <hankgrabowski@gmail.com>
Thu, 16 Feb 2023 13:08:58 +0000 (08:08 -0500)
src/Module/Api/Mastodon/Timelines/Direct.php
src/Module/Api/Mastodon/Timelines/ListTimeline.php

index a5f1f97f321dcc21c702b303de2ea66f37d9e60b..82b96e698ff1961ba8fcc57ca7d0ea3c3193508f 100644 (file)
@@ -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 = [];
index a8de13056ec45fb0b1367c31813453f8c63b6bf3..378e3eeaaf423194f3fffaa6951a1357546e92c8 100644 (file)
@@ -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();