Merge pull request #9944 from MrPetovan/bug/9905-block-contact-not-found
authorMichael Vogel <icarus@dabo.de>
Thu, 18 Feb 2021 23:15:41 +0000 (00:15 +0100)
committerGitHub <noreply@github.com>
Thu, 18 Feb 2021 23:15:41 +0000 (00:15 +0100)
Use correct Contact\User::setBlocked instead of Contact::block for /item/block endpoint

mod/item.php

index 8c256cf..7c11d73 100644 (file)
@@ -847,12 +847,7 @@ function item_content(App $a)
                                throw new HTTPException\NotFoundException('Item not found');
                        }
 
-                       $cdata = Contact::getPublicAndUserContacID($item['author-id'], local_user());
-                       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']));
+                       Contact\User::setBlocked($item['author-id'], local_user(), true);
 
                        if (DI::mode()->isAjax()) {
                                // ajax return: [<item id>, 0 (no perm) | <owner id>]