Merge pull request #12837 from HankG/fix-blocks-ignores-in-full-context-status-request
Incorporate ignore/blocks in Mastodon Status Context Endpoint
This commit is contained in:
commit
defbf87d9c
1 changed files with 12 additions and 4 deletions
|
@ -49,6 +49,7 @@ class Context extends BaseApi
|
||||||
'since_id' => 0, // Return results newer than this id
|
'since_id' => 0, // Return results newer than this id
|
||||||
'min_id' => 0, // Return results immediately newer than this id
|
'min_id' => 0, // Return results immediately newer than this id
|
||||||
'limit' => 40, // Maximum number of results to return. Defaults to 40.
|
'limit' => 40, // Maximum number of results to return. Defaults to 40.
|
||||||
|
'show_all' => false, // shows posts for all users including blocked and ignored users
|
||||||
], $request);
|
], $request);
|
||||||
|
|
||||||
$id = $this->parameters['id'];
|
$id = $this->parameters['id'];
|
||||||
|
@ -74,6 +75,13 @@ class Context extends BaseApi
|
||||||
$params['order'] = ['uri-id'];
|
$params['order'] = ['uri-id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($uid) && !$request['show_all']) {
|
||||||
|
$condition = DBA::mergeConditions(
|
||||||
|
$condition,
|
||||||
|
["NOT `author-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND (`blocked` OR `ignored`))", $uid]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$posts = Post::selectPosts(['uri-id', 'thr-parent-id'], $condition, $params);
|
$posts = Post::selectPosts(['uri-id', 'thr-parent-id'], $condition, $params);
|
||||||
while ($post = Post::fetch($posts)) {
|
while ($post = Post::fetch($posts)) {
|
||||||
if ($post['uri-id'] == $post['thr-parent-id']) {
|
if ($post['uri-id'] == $post['thr-parent-id']) {
|
||||||
|
|
Loading…
Reference in a new issue