]> git.mxchange.org Git - friendica.git/commitdiff
Improved similarity to ostatus group feeds
authorMichael <heluecht@pirati.ca>
Sun, 18 Mar 2018 11:18:25 +0000 (11:18 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 18 Mar 2018 11:18:25 +0000 (11:18 +0000)
src/Protocol/OStatus.php

index 23c6ef557bae740b814d9d6c03c319d16abbac40..bf0cca90c21e91adcf233adcf1d668eeedb632c0 100644 (file)
@@ -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"]);