mirror of
https://github.com/friendica/friendica
synced 2025-04-25 11:50:11 +00:00
32 lines
821 B
PHP
32 lines
821 B
PHP
<?php
|
|
|
|
// Copyright (C) 2010-2024, the Friendica project
|
|
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
namespace Friendica\Module\Api\Mastodon\Accounts;
|
|
|
|
use Friendica\DI;
|
|
use Friendica\Model\Contact;
|
|
use Friendica\Module\BaseApi;
|
|
|
|
/**
|
|
* @see https://docs.joinmastodon.org/methods/accounts/
|
|
*/
|
|
class Block extends BaseApi
|
|
{
|
|
protected function post(array $request = [])
|
|
{
|
|
$this->checkAllowedScope(self::SCOPE_FOLLOW);
|
|
$uid = self::getCurrentUserID();
|
|
|
|
if (empty($this->parameters['id'])) {
|
|
$this->logAndJsonError(422, $this->errorFactory->UnprocessableEntity());
|
|
}
|
|
|
|
Contact\User::setBlocked($this->parameters['id'], $uid, true);
|
|
|
|
$this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
|
|
}
|
|
}
|