]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/OStatus.php
Merge pull request #8835 from tobiasd/20200701-lng
[friendica.git] / src / Protocol / OStatus.php
index 24decc000eda2ad2b41029c2ca4f29070bac3d56..0b9a45fc3b4082c8e0e1034791466ca8555e61c4 100644 (file)
@@ -1829,11 +1829,12 @@ class OStatus
                $item["private"] = Item::PRIVATE;
 
                $contact = Probe::uri($item['follow']);
+               $item['follow'] = $contact['url'];
 
-               if ($contact['alias'] == '') {
-                       $contact['alias'] = $contact["url"];
-               } else {
+               if ($contact['alias']) {
                        $item['follow'] = $contact['alias'];
+               } else {
+                       $contact['alias'] = $contact['url'];
                }
 
                $condition = ['uid' => $owner['uid'], 'nurl' => Strings::normaliseLink($contact["url"])];
@@ -2020,7 +2021,7 @@ class OStatus
        {
                $mentioned = [];
 
-               if (($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']) || (($item['thr-parent'] !== '') && ($item['thr-parent'] !== $item['uri']))) {
+               if ($item['gravity'] != GRAVITY_PARENT) {
                        $parent = Item::selectFirst(['guid', 'author-link', 'owner-link'], ['id' => $item['parent']]);
                        $parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
 
@@ -2087,10 +2088,8 @@ 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::getByURL($mention, 0, ['contact-type']);
+                       if (!empty($contact) && ($contact['contact-type'] == Contact::TYPE_COMMUNITY)) {
                                XML::addElement($doc, $entry, "link", "",
                                        [
                                                "rel" => "mentioned",