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;
foreach ($mentioned as $mention) {
$condition = ['uid' => $owner['uid'], 'nurl' => Strings::normaliseLink($mention)];
$contact = DBA::selectFirst('contact', ['forum', 'prv', 'self', 'contact-type'], $condition);
if ($contact["forum"] || $contact["prv"] || ($owner['contact-type'] == Contact::TYPE_COMMUNITY) ||
($contact['self'] && ($owner['account-type'] == User::ACCOUNT_TYPE_COMMUNITY))) {
$contact = Contact::getDetailsByURL($mention, $owner['uid']);
if (!empty($contact) && ($contact["forum"] || $contact["prv"] || ($owner['contact-type'] == Contact::TYPE_COMMUNITY) ||
($contact['self'] && ($owner['account-type'] == User::ACCOUNT_TYPE_COMMUNITY)))) {
XML::addElement($doc, $entry, "link", "",
[
"rel" => "mentioned",