]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Transmitter.php
Merge pull request #8696 from MrPetovan/bug/8694-event-network-unkn
[friendica.git] / src / Protocol / ActivityPub / Transmitter.php
index 6e639fb9896eb900ac10d6efd601998a68f2c326..9cb5efca413038ce9aef3538a5aae04a019be66c 100644 (file)
@@ -729,7 +729,7 @@ class Transmitter
                        $data = [];
                }
 
-               $data['id'] = $mail['uri'] . '#Create';
+               $data['id'] = $mail['uri'] . '/Create';
                $data['type'] = 'Create';
                $data['actor'] = $mail['author-link'];
                $data['published'] = DateTimeFormat::utc($mail['created'] . '+00:00', DateTimeFormat::ATOM);
@@ -893,7 +893,7 @@ class Transmitter
                        $data = [];
                }
 
-               $data['id'] = $item['uri'] . '#' . $type;
+               $data['id'] = $item['uri'] . '/' . $type;
                $data['type'] = $type;
 
                if (Item::isForumPost($item) && ($type != 'Announce')) {
@@ -1215,7 +1215,7 @@ class Transmitter
        {
                $event = [];
                $event['name'] = $item['event-summary'];
-               $event['content'] = BBCode::convert($item['event-desc'], false, 9);
+               $event['content'] = BBCode::convert($item['event-desc'], false, BBCode::ACTIVITYPUB);
                $event['startTime'] = DateTimeFormat::utc($item['event-start'] . '+00:00', DateTimeFormat::ATOM);
 
                if (!$item['event-nofinish']) {
@@ -1294,7 +1294,7 @@ class Transmitter
                $body = $item['body'];
 
                if (empty($item['uid']) || !Feature::isEnabled($item['uid'], 'explicit_mentions')) {
-                       $body = self::prependMentions($body, $permission_block);
+                       $body = self::prependMentions($body, $item['uri-id']);
                }
 
                if ($type == 'Note') {
@@ -1309,7 +1309,7 @@ class Transmitter
                        $regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
                        $body = preg_replace_callback($regexp, ['self', 'mentionCallback'], $body);
 
-                       $data['content'] = BBCode::convert($body, false, 9);
+                       $data['content'] = BBCode::convert($body, false, BBCode::ACTIVITYPUB);
                }
 
                // The regular "content" field does contain a minimized HTML. This is done since systems like
@@ -1843,22 +1843,18 @@ class Transmitter
                HTTPSignature::transmit($signed, $profile['inbox'], $uid);
        }
 
-       private static function prependMentions($body, array $permission_block)
+       private static function prependMentions($body, int $uriid)
        {
-               if (DI::config()->get('system', 'disable_implicit_mentions')) {
-                       return $body;
-               }
-
                $mentions = [];
 
-               foreach ($permission_block['to'] as $profile_url) {
-                       $profile = Contact::getDetailsByURL($profile_url);
+               foreach (Tag::getByURIId($uriid, [Tag::IMPLICIT_MENTION]) as $tag) {
+                       $profile = Contact::getDetailsByURL($tag['url']);
                        if (!empty($profile['addr'])
                                && $profile['contact-type'] != Contact::TYPE_COMMUNITY
                                && !strstr($body, $profile['addr'])
-                               && !strstr($body, $profile_url)
+                               && !strstr($body, $tag['url'])
                        ) {
-                               $mentions[] = '@[url=' . $profile_url . ']' . $profile['nick'] . '[/url]';
+                               $mentions[] = '@[url=' . $tag['url'] . ']' . $profile['nick'] . '[/url]';
                        }
                }