diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php
index 177d648081..44a6189d9d 100644
--- a/src/Content/Text/BBCode.php
+++ b/src/Content/Text/BBCode.php
@@ -1748,6 +1748,27 @@ class BBCode
}
}
+ // Handle mentions and hashtag links
+ if ($simple_html == self::DIASPORA) {
+ // The ! is converted to @ since Diaspora only understands the @
+ $text = preg_replace("/([@!])\[url\=(.*?)\](.*?)\[\/url\]/ism",
+ '@$3',
+ $text);
+ } elseif (in_array($simple_html, [self::OSTATUS, self::ACTIVITYPUB])) {
+ $text = preg_replace("/([@!])\[url\=(.*?)\](.*?)\[\/url\]/ism",
+ '$1$3',
+ $text);
+ $text = preg_replace("/([#])\[url\=(.*?)\](.*?)\[\/url\]/ism",
+ '$1$3',
+ $text);
+ } elseif (in_array($simple_html, [self::INTERNAL, self::EXTERNAL, self::API])) {
+ $text = preg_replace("/([@!])\[url\=(.*?)\](.*?)\[\/url\]/ism",
+ '$1$3',
+ $text);
+ } else {
+ $text = preg_replace("/([#@!])\[url\=(.*?)\](.*?)\[\/url\]/ism", '$1$3', $text);
+ }
+
if (!$for_plaintext) {
if (in_array($simple_html, [self::OSTATUS, self::API, self::ACTIVITYPUB])) {
$text = preg_replace_callback("/\[url\](.*?)\[\/url\]/ism", 'self::convertUrlForActivityPubCallback', $text);
@@ -1758,24 +1779,6 @@ class BBCode
$text = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", 'self::removePictureLinksCallback', $text);
}
- // Remove all hashtag addresses
- if ($simple_html && !in_array($simple_html, [self::DIASPORA, self::OSTATUS, self::ACTIVITYPUB])) {
- $text = preg_replace("/([#@!])\[url\=(.*?)\](.*?)\[\/url\]/ism", '$1$3', $text);
- } elseif ($simple_html == self::DIASPORA) {
- // The ! is converted to @ since Diaspora only understands the @
- $text = preg_replace("/([@!])\[url\=(.*?)\](.*?)\[\/url\]/ism",
- '@$3',
- $text);
- } elseif (in_array($simple_html, [self::OSTATUS, self::ACTIVITYPUB])) {
- $text = preg_replace("/([@!])\[url\=(.*?)\](.*?)\[\/url\]/ism",
- '$1$3',
- $text);
- } elseif (!$simple_html) {
- $text = preg_replace("/([@!])\[url\=(.*?)\](.*?)\[\/url\]/ism",
- '$1$3',
- $text);
- }
-
// Bookmarks in red - will be converted to bookmarks in friendica
$text = preg_replace("/#\^\[url\](.*?)\[\/url\]/ism", '[bookmark=$1]$1[/bookmark]', $text);
$text = preg_replace("/#\^\[url\=(.*?)\](.*?)\[\/url\]/ism", '[bookmark=$1]$2[/bookmark]', $text);
diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php
index a65ebc8cda..53c060e87d 100644
--- a/src/Protocol/ActivityPub/Transmitter.php
+++ b/src/Protocol/ActivityPub/Transmitter.php
@@ -1356,12 +1356,12 @@ class Transmitter
return '';
}
- $data = Contact::getByURL($match[1], false, ['url', 'alias', 'nick']);
+ $data = Contact::getByURL($match[1], false, ['url', 'nick']);
if (empty($data['nick'])) {
return $match[0];
}
- return '[url=' . $data['url'] . ']@' . $data['nick'] . '[/url]';
+ return '@[url=' . $data['url'] . ']' . $data['nick'] . '[/url]';
}
/**