Use Contact::getDetailsByURL instead of custom query in Protocol\OStatus

- Address part of https://github.com/friendica/friendica/issues/8475#issuecomment-646457104
This commit is contained in:
Hypolite Petovan 2020-06-19 07:10:39 -04:00
parent aafef02789
commit a83681e93a

View file

@ -2087,10 +2087,9 @@ class OStatus
$mentioned = $newmentions; $mentioned = $newmentions;
foreach ($mentioned as $mention) { foreach ($mentioned as $mention) {
$condition = ['uid' => $owner['uid'], 'nurl' => Strings::normaliseLink($mention)]; $contact = Contact::getDetailsByURL($mention, $owner['uid']);
$contact = DBA::selectFirst('contact', ['forum', 'prv', 'self', 'contact-type'], $condition); if (!empty($contact) && ($contact["forum"] || $contact["prv"] || ($owner['contact-type'] == Contact::TYPE_COMMUNITY) ||
if ($contact["forum"] || $contact["prv"] || ($owner['contact-type'] == Contact::TYPE_COMMUNITY) || ($contact['self'] && ($owner['account-type'] == User::ACCOUNT_TYPE_COMMUNITY)))) {
($contact['self'] && ($owner['account-type'] == User::ACCOUNT_TYPE_COMMUNITY))) {
XML::addElement($doc, $entry, "link", "", XML::addElement($doc, $entry, "link", "",
[ [
"rel" => "mentioned", "rel" => "mentioned",