Add blocked/ignored filters to Mastodon Timeline API Home and Tags endpoints

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

View File

@ -90,6 +90,13 @@ class Home extends BaseApi
$condition = DBA::mergeConditions($condition, ['gravity' => Item::GRAVITY_PARENT]);
}
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();

View File

@ -104,6 +104,13 @@ class Tag 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]
);
}
$items = DBA::select('tag-search-view', ['uri-id'], $condition, $params);
$display_quotes = self::appSupportsQuotes();