From 9d6c0afad60fbdcaaa0a58fec3775f1291f8a44c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 17 Oct 2024 12:34:18 +0200 Subject: [PATCH] feat(comments): Support mentioning emails Signed-off-by: Joas Schilling --- lib/private/Comments/Comment.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php index 0308d01ab9a..46912720a3c 100644 --- a/lib/private/Comments/Comment.php +++ b/lib/private/Comments/Comment.php @@ -202,7 +202,7 @@ class Comment implements IComment { * */ public function getMentions(): array { - $ok = preg_match_all("/\B(?getMessage(), $mentions); + $ok = preg_match_all("/\B(?getMessage(), $mentions); if (!$ok || !isset($mentions[0])) { return []; } @@ -217,6 +217,10 @@ class Comment implements IComment { if (str_starts_with($cleanId, 'guest/')) { $result[] = ['type' => 'guest', 'id' => $cleanId]; + } elseif (str_starts_with($cleanId, 'email/')) { + /** @var non-empty-lowercase-string $cleanId */ + $cleanId = substr($cleanId, 6); + $result[] = ['type' => 'email', 'id' => $cleanId]; } elseif (str_starts_with($cleanId, 'federated_group/')) { $result[] = ['type' => 'federated_group', 'id' => substr($cleanId, 16)]; } elseif (str_starts_with($cleanId, 'group/')) { -- 2.39.5