Add blocked/ignored filters to Mastodon Timeline API Direct and List endpoints

This commit is contained in:
Hank Grabowski 2023-02-16 08:08:58 -05:00
parent d6c1e85b5f
commit a4515daca4
2 changed files with 14 additions and 0 deletions

View 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 = [];

View 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();