From d8824cc3bcb725b36c9abd0df7cee3a06125b0c2 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 18 Mar 2018 11:18:25 +0000 Subject: [PATCH] Improved similarity to ostatus group feeds --- src/Protocol/OStatus.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 23c6ef557b..bf0cca90c2 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -2023,12 +2023,10 @@ class OStatus $mentioned = $newmentions; foreach ($mentioned as $mention) { - $r = q( - "SELECT `forum`, `prv` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s'", - intval($owner["uid"]), - dbesc(normalise_link($mention)) - ); - if ($r[0]["forum"] || $r[0]["prv"]) { + $condition = ['uid' => $owner['uid'], 'nurl' => normalise_link($mention)]; + $contact = dba::selectFirst('contact', ['forum', 'prv', 'self', 'contact-type'], $condition); + if ($contact["forum"] || $contact["prv"] || ($owner['contact-type'] == ACCOUNT_TYPE_COMMUNITY) || + ($contact['self'] && ($owner['account-type'] == ACCOUNT_TYPE_COMMUNITY))) { XML::addElement($doc, $entry, "link", "", [ "rel" => "mentioned", @@ -2045,6 +2043,12 @@ class OStatus } } + if ($owner['account-type'] == ACCOUNT_TYPE_COMMUNITY) { + XML::addElement($doc, $entry, "link", "", ["rel" => "mentioned", + "ostatus:object-type" => "http://activitystrea.ms/schema/1.0/group", + "href" => $owner['url']]); + } + if (!$item["private"]) { XML::addElement($doc, $entry, "link", "", ["rel" => "ostatus:attention", "href" => "http://activityschema.org/collection/public"]);