Browse Source

[UTIL][Formatting] Mention title is not always defined

oauth1
Eliseu Amaro 7 months ago
parent
commit
eff9318c1d
Signed by: eli <mail@eliseuama.ro> GPG Key ID: 96DA09D4B97BC2D5
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/Util/Formatting.php

+ 2
- 2
src/Util/Formatting.php View File

@@ -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]);


Loading…
Cancel
Save