From aafef027892ee550335785316c7cda59bb6d374e Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 19 Jun 2020 07:05:58 -0400 Subject: [PATCH 1/2] Replace obsolete anonymity test with a slightly less obsolete one in Model\Item - Address part of https://github.com/friendica/friendica/issues/8475#issuecomment-646457104 --- src/Model/Item.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 0a242aa05..89b81b99a 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -3490,9 +3490,7 @@ class Item */ public static function getPlink($item) { - $a = DI::app(); - - if ($a->user['nickname'] != "") { + if (local_user()) { $ret = [ 'href' => "display/" . $item['guid'], 'orig' => "display/" . $item['guid'], @@ -3504,7 +3502,6 @@ class Item $ret["href"] = DI::baseUrl()->remove($item['plink']); $ret["title"] = DI::l10n()->t('link to source'); } - } elseif (!empty($item['plink']) && ($item['private'] != self::PRIVATE)) { $ret = [ 'href' => $item['plink'], From a83681e93adb4162ad0bece6dff8177ae13cccf3 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 19 Jun 2020 07:10:39 -0400 Subject: [PATCH 2/2] Use Contact::getDetailsByURL instead of custom query in Protocol\OStatus - Address part of https://github.com/friendica/friendica/issues/8475#issuecomment-646457104 --- src/Protocol/OStatus.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 411bdd63c..a2181beeb 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -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",