From aa2b4e15a3beae536c35ec7ca9893b8154a6e87a Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 5 Nov 2022 22:35:35 +0000 Subject: [PATCH 1/3] Issue 11846: Fix client behaviour when following hash tags --- src/Content/Text/BBCode.php | 3 +++ src/Object/Api/Mastodon/Status.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index e8a396a35..86d8c6ac8 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1975,6 +1975,9 @@ class BBCode $text = preg_replace("/([@!])\[url\=(.*?)\](.*?)\[\/url\]/ism", '$1$3', $text); + $text = preg_replace("/([#])\[url\=(.*?)\](.*?)\[\/url\]/ism", + '', + $text); } else { $text = preg_replace("/([#@!])\[url\=(.*?)\](.*?)\[\/url\]/ism", '$1$3', $text); } diff --git a/src/Object/Api/Mastodon/Status.php b/src/Object/Api/Mastodon/Status.php index ced691964..b0832f0c3 100644 --- a/src/Object/Api/Mastodon/Status.php +++ b/src/Object/Api/Mastodon/Status.php @@ -109,7 +109,7 @@ class Status extends BaseDataTransferObject } $this->sensitive = $sensitive; - $this->spoiler_text = $item['title'] ?: $item['content-warning']; + $this->spoiler_text = ($item['title'] ?: $item['content-warning']) ?: ''; $visibility = ['public', 'private', 'unlisted']; $this->visibility = $visibility[$item['private']]; From 9fa3df3cbf05e78f853f2d8343006cb23d619eb0 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 5 Nov 2022 22:39:15 +0000 Subject: [PATCH 2/3] "arrat" to "array" --- src/Content/Text/BBCode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 86d8c6ac8..2ed4e57b3 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1305,7 +1305,7 @@ class BBCode /** * Callback: Expands links from given $match array * - * @param arrat $match Array with link match + * @param array $match Array with link match * @return string BBCode */ private static function expandLinksCallback(array $match): string @@ -1320,7 +1320,7 @@ class BBCode /** * Callback: Cleans picture links * - * @param arrat $match Array with link match + * @param array $match Array with link match * @return string BBCode */ private static function cleanPictureLinksCallback(array $match): string From 52f74b6312357cd1cc050ed7fc96b8357090cd30 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 5 Nov 2022 23:51:16 +0100 Subject: [PATCH 3/3] Update src/Object/Api/Mastodon/Status.php Co-authored-by: Hypolite Petovan --- src/Object/Api/Mastodon/Status.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Object/Api/Mastodon/Status.php b/src/Object/Api/Mastodon/Status.php index b0832f0c3..8ba99ebfa 100644 --- a/src/Object/Api/Mastodon/Status.php +++ b/src/Object/Api/Mastodon/Status.php @@ -109,7 +109,7 @@ class Status extends BaseDataTransferObject } $this->sensitive = $sensitive; - $this->spoiler_text = ($item['title'] ?: $item['content-warning']) ?: ''; + $this->spoiler_text = $item['title'] ?: $item['content-warning'] ?: ''; $visibility = ['public', 'private', 'unlisted']; $this->visibility = $visibility[$item['private']];