Merge pull request #9944 from MrPetovan/bug/9905-block-contact-not-found

Use correct Contact\User::setBlocked instead of Contact::block for /item/block endpoint
This commit is contained in:
Michael Vogel 2021-02-19 00:15:41 +01:00 committed by GitHub
commit 5f6d1b88b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -847,12 +847,7 @@ function item_content(App $a)
throw new HTTPException\NotFoundException('Item not found'); throw new HTTPException\NotFoundException('Item not found');
} }
$cdata = Contact::getPublicAndUserContacID($item['author-id'], local_user()); Contact\User::setBlocked($item['author-id'], local_user(), true);
if (empty($cdata['user'])) {
throw new HTTPException\NotFoundException('Contact not found');
}
Contact::block($cdata['user'], DI::l10n()->t('Blocked on item with guid %s', $item['guid']));
if (DI::mode()->isAjax()) { if (DI::mode()->isAjax()) {
// ajax return: [<item id>, 0 (no perm) | <owner id>] // ajax return: [<item id>, 0 (no perm) | <owner id>]