From eff9318c1d57d051b4f4d088b682a29413e83fb4 Mon Sep 17 00:00:00 2001 From: Eliseu Amaro Date: Thu, 13 Jan 2022 18:07:19 +0000 Subject: [PATCH] [UTIL][Formatting] Mention title is not always defined --- src/Util/Formatting.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Util/Formatting.php b/src/Util/Formatting.php index 757595acf7..07e27aab23 100644 --- a/src/Util/Formatting.php +++ b/src/Util/Formatting.php @@ -450,7 +450,7 @@ abstract class Formatting foreach ($points as $position => $mention) { $linkText = self::linkifyMentionArray($mention); - $text = substr_replace($text, $linkText, $position-1, $mention['length']+1); + $text = substr_replace($text, $linkText, $position - 1, $mention['length'] + 1); } return [$text, $mentions]; @@ -471,7 +471,7 @@ abstract class Formatting } $output = HTML::html(['span' => ['attrs' => ['class' => 'h-card'], - '@' . HTML::html(['a' => ['attrs' => $attrs, $mention['title']]], options: ['indent' => false]), + '@' . HTML::html(['a' => ['attrs' => $attrs, $mention['title'] ?? $mention['text']]], options: ['indent' => false]), ]], options: ['indent' => false, 'raw' => true]); Event::handle('EndLinkifyMention', [$mention, &$output]);