Merge pull request #12825 from HankG/fix-blocks-listing
Remove extraneous ID parameter from Mastodon Blocks Listing API
This commit is contained in:
commit
5f56918d3e
1 changed files with 2 additions and 10 deletions
|
@ -39,15 +39,6 @@ class Blocks extends BaseApi
|
||||||
self::checkAllowedScope(self::SCOPE_READ);
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
if (empty($this->parameters['id'])) {
|
|
||||||
DI::mstdnError()->UnprocessableEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = $this->parameters['id'];
|
|
||||||
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
|
|
||||||
DI::mstdnError()->RecordNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
$request = $this->getRequest([
|
$request = $this->getRequest([
|
||||||
'max_id' => 0, // Return results older than this id
|
'max_id' => 0, // Return results older than this id
|
||||||
'since_id' => 0, // Return results newer than this id
|
'since_id' => 0, // Return results newer than this id
|
||||||
|
@ -57,7 +48,7 @@ class Blocks extends BaseApi
|
||||||
|
|
||||||
$params = ['order' => ['cid' => true], 'limit' => $request['limit']];
|
$params = ['order' => ['cid' => true], 'limit' => $request['limit']];
|
||||||
|
|
||||||
$condition = ['cid' => $id, 'blocked' => true, 'uid' => $uid];
|
$condition = ['blocked' => true, 'uid' => $uid];
|
||||||
|
|
||||||
if (!empty($request['max_id'])) {
|
if (!empty($request['max_id'])) {
|
||||||
$condition = DBA::mergeConditions($condition, ["`cid` < ?", $request['max_id']]);
|
$condition = DBA::mergeConditions($condition, ["`cid` < ?", $request['max_id']]);
|
||||||
|
@ -74,6 +65,7 @@ class Blocks extends BaseApi
|
||||||
}
|
}
|
||||||
|
|
||||||
$followers = DBA::select('user-contact', ['cid'], $condition, $params);
|
$followers = DBA::select('user-contact', ['cid'], $condition, $params);
|
||||||
|
$accounts = [];
|
||||||
while ($follower = DBA::fetch($followers)) {
|
while ($follower = DBA::fetch($followers)) {
|
||||||
self::setBoundaries($follower['cid']);
|
self::setBoundaries($follower['cid']);
|
||||||
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);
|
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);
|
||||||
|
|
Loading…
Reference in a new issue