]> git.mxchange.org Git - friendica.git/commitdiff
Fix: Mentions in the HTML part of the "contentMap" now are links
authorMichael <heluecht@pirati.ca>
Wed, 13 Nov 2019 06:43:36 +0000 (06:43 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 13 Nov 2019 06:43:36 +0000 (06:43 +0000)
src/Content/Text/BBCode.php
src/Protocol/ActivityPub/Transmitter.php

index 1dffb05073b70f7f7f30c6fe35b86894986147b8..167a0539758aa2af5e0e5217e1a4d54aced32c25 100644 (file)
@@ -1680,7 +1680,7 @@ class BBCode extends BaseObject
                $text = str_replace(["\r","\n"], ['<br />', '<br />'], $text);
 
                // Remove all hashtag addresses
-               if ((!$try_oembed || $simple_html) && !in_array($simple_html, [3, 7, 9])) {
+               if ($simple_html && !in_array($simple_html, [3, 7, 9])) {
                        $text = preg_replace("/([#@!])\[url\=(.*?)\](.*?)\[\/url\]/ism", '$1$3', $text);
                } elseif ($simple_html == 3) {
                        // The ! is converted to @ since Diaspora only understands the @
index 82ee97c9ededb6732852499608607582e0fcb85d..545ac22c699b0a668cfe486c7d17f617dd01d123 100644 (file)
@@ -1270,7 +1270,10 @@ class Transmitter
                        $data['content'] = BBCode::convert($body, false, 9);
                }
 
-               $data['contentMap']['text/html'] = BBCode::convert($item['body'], false);
+               $regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
+               $richbody = preg_replace_callback($regexp, ['self', 'mentionCallback'], $item['body']);
+
+               $data['contentMap']['text/html'] = BBCode::convert($richbody, false);
                $data['contentMap']['text/markdown'] = BBCode::toMarkdown($item["body"]);
 
                $data['source'] = ['content' => $item['body'], 'mediaType' => "text/bbcode"];