Prevent contact relationships with node- or user-level blocked contacts

This commit is contained in:
Hypolite Petovan 2019-05-19 18:46:58 -04:00
parent ea77f214d7
commit 62dfcbb074

View File

@ -2137,13 +2137,18 @@ class Contact extends BaseObject
return false; return false;
} }
$fields = ['url', 'name', 'nick', 'photo', 'network']; $fields = ['url', 'name', 'nick', 'photo', 'network', 'blocked'];
$pub_contact = DBA::selectFirst('contact', $fields, ['id' => $datarray['author-id']]); $pub_contact = DBA::selectFirst('contact', $fields, ['id' => $datarray['author-id']]);
if (!DBA::isResult($pub_contact)) { if (!DBA::isResult($pub_contact)) {
// Should never happen // Should never happen
return false; return false;
} }
// Contact is blocked on node-level or user-level
if (!empty($pub_contact['blocked']) || !empty($contact['blocked'])) {
return false;
}
$url = defaults($datarray, 'author-link', $pub_contact['url']); $url = defaults($datarray, 'author-link', $pub_contact['url']);
$name = $pub_contact['name']; $name = $pub_contact['name'];
$photo = $pub_contact['photo']; $photo = $pub_contact['photo'];