diff options
author | Joas Schilling <coding@schilljs.com> | 2019-07-10 15:33:10 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-07-10 15:33:10 +0200 |
commit | 77918356d642e166a2b60cd120f291c72888930b (patch) | |
tree | 680979a9bb2a097b142e89d5aef1ea3b5abf7c47 /lib/private/Comments | |
parent | ad51857e54666617544f22353312a9c0668022f9 (diff) | |
download | nextcloud-server-77918356d642e166a2b60cd120f291c72888930b.tar.gz nextcloud-server-77918356d642e166a2b60cd120f291c72888930b.zip |
Allow guest mentions of talk to be parsed
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Comments')
-rw-r--r-- | lib/private/Comments/Comment.php | 9 |
1 files 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(?<![^a-z0-9_\-@\.\'\s])@(\"[a-z0-9_\-@\.\' ]+\"|[a-z0-9_\-@\.\']+)/i", $this->getMessage(), $mentions); + $ok = preg_match_all("/\B(?<![^a-z0-9_\-@\.\'\s])@(\"guest\/[a-f0-9]+\"|\"[a-z0-9_\-@\.\' ]+\"|[a-z0-9_\-@\.\']+)/i", $this->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; } |