]> git.mxchange.org Git - friendica.git/commitdiff
Use Contact::getDetailsByURL instead of custom query in Protocol\OStatus
authorHypolite Petovan <hypolite@mrpetovan.com>
Fri, 19 Jun 2020 11:10:39 +0000 (07:10 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Fri, 19 Jun 2020 11:10:39 +0000 (07:10 -0400)
- Address part of https://github.com/friendica/friendica/issues/8475#issuecomment-646457104

src/Protocol/OStatus.php

index 411bdd63cbe591295513e27b6105dc58d47c8e78..a2181beeb3ef546159982fa4004d57c12b9d7d6f 100644 (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",