From 2482072457b520af43dd486f552dd31283b14fdf Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 14 Jun 2019 05:25:10 +0000 Subject: [PATCH] Issue 5983: Central check for blocked and ignored contacts added --- src/Model/Item.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Model/Item.php b/src/Model/Item.php index ba41f91d9..67d051d4c 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1453,6 +1453,16 @@ class Item extends BaseObject return 0; } + if (!empty($uid) && Contact::isBlockedByUser($item['author-link'], $uid)) { + Logger::notice('Author is blocked by user', ['author-link' => $item['author-link'], 'uid' => $uid, 'item-uri' => $item['uri']]); + return 0; + } + + if (!empty($uid) && ($item['parent-uri'] === $item['uri']) && Contact::isIgnoredByUser($item['author-link'], $uid)) { + Logger::notice('Author is ignored by user', ['author-link' => $item['author-link'], 'uid' => $uid, 'item-uri' => $item['uri']]); + return 0; + } + $default = ['url' => $item['owner-link'], 'name' => $item['owner-name'], 'photo' => $item['owner-avatar'], 'network' => $item['network']]; @@ -1468,6 +1478,16 @@ class Item extends BaseObject return 0; } + if (!empty($uid) && Contact::isBlockedByUser($item['owner-link'], $uid)) { + Logger::notice('Owner is blocked by user', ['owner-link' => $item['owner-link'], 'uid' => $uid, 'item-uri' => $item['uri']]); + return 0; + } + + if (!empty($uid) && ($item['parent-uri'] === $item['uri']) && Contact::isIgnoredByUser($item['owner-link'], $uid)) { + Logger::notice('Owner is ignored by user', ['owner-link' => $item['owner-link'], 'uid' => $uid, 'item-uri' => $item['uri']]); + return 0; + } + if ($item['network'] == Protocol::PHANTOM) { $item['network'] = Protocol::DFRN; Logger::notice('Missing network, setting to {network}.', [