Merge pull request #7832 from annando/ap-rich-mention

Fix: Mentions in the HTML part of the "contentMap" now are links
This commit is contained in:
Philipp 2019-11-13 08:09:07 +01:00 committed by GitHub
commit ff1e70a7ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View 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 @

View 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"];