summaryrefslogtreecommitdiffstats
path: root/lib/private/Comments
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-10-12 14:25:46 +0200
committerJoas Schilling <coding@schilljs.com>2018-11-07 12:33:44 +0100
commit10ba0bed8a6a3f43526c36768feea522325d4a80 (patch)
tree291b31e55b28624c7a58c8d161eb214e5347875a /lib/private/Comments
parentc26d847d19c967aa5bc99f9bc15c27c7e95ee55f (diff)
downloadnextcloud-server-10ba0bed8a6a3f43526c36768feea522325d4a80.tar.gz
nextcloud-server-10ba0bed8a6a3f43526c36768feea522325d4a80.zip
Match mentions when the username is wrapped in quotes
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Comments')
-rw-r--r--lib/private/Comments/Comment.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php
index 94c43be622b..76c6e1d1f6b 100644
--- a/lib/private/Comments/Comment.php
+++ b/lib/private/Comments/Comment.php
@@ -225,14 +225,14 @@ class Comment implements IComment {
*
*/
public function getMentions() {
- $ok = preg_match_all("/\B(?<![^a-z0-9_\-@\.\'\s])@[a-z0-9_\-@\.\']+/i", $this->getMessage(), $mentions);
+ $ok = preg_match_all("/\B(?<![^a-z0-9_\-@\.\'\s])@(\"[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' => substr($uid, 1)];
+ $result[] = ['type' => 'user', 'id' => trim(substr($uid, 1), '"')];
}
return $result;
}