From 77918356d642e166a2b60cd120f291c72888930b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 10 Jul 2019 15:33:10 +0200 Subject: [PATCH] Allow guest mentions of talk to be parsed Signed-off-by: Joas Schilling --- lib/private/Comments/Comment.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php index c7cafa0524d..c9862c64ca6 100644 --- a/lib/private/Comments/Comment.php +++ b/lib/private/Comments/Comment.php @@ -226,14 +226,19 @@ class Comment implements IComment { * */ public function getMentions() { - $ok = preg_match_all("/\B(?getMessage(), $mentions); + $ok = preg_match_all("/\B(?getMessage(), $mentions); if(!$ok || !isset($mentions[0]) || !is_array($mentions[0])) { return []; } $uids = array_unique($mentions[0]); $result = []; foreach ($uids as $uid) { - $result[] = ['type' => 'user', 'id' => trim(substr($uid, 1), '"')]; + $cleanUid = trim(substr($uid, 1), '"'); + if (strpos($cleanUid, 'guest/') === 0) { + $result[] = ['type' => 'guest', 'id' => $cleanUid]; + } else { + $result[] = ['type' => 'user', 'id' => $cleanUid]; + } } return $result; } -- 2.39.5