1
0
Fork 0

Merge pull request #12804 from HankG/fix-blocked-users-in-mastodon-api-timelines

Add Block/Ignore filtering on all Mastodon API Timeline endpoints
This commit is contained in:
Hypolite Petovan 2023-02-20 08:27:33 -05:00 committed by GitHub
commit 5bba6dd4b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 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

@ -90,11 +90,6 @@ class PublicTimeline 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::selectPostsForUser($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();