Issue 5983: Central check for blocked and ignored contacts added

This commit is contained in:
Michael 2019-06-14 05:25:10 +00:00
parent 9054e00873
commit 2482072457

View file

@ -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}.', [