diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-07-12 10:35:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-12 10:35:54 +0200 |
commit | c193c0d46670fdda79f74523eb0f616175dd513b (patch) | |
tree | 2ef92fbfb24408eec5a7d1d80228ed9c3c4fc267 /lib/private | |
parent | 951f16da65bcab4826f2f20b771479dad8594407 (diff) | |
parent | 092d34d9df352ff381d92e62d80d0ea20fd395ee (diff) | |
download | nextcloud-server-c193c0d46670fdda79f74523eb0f616175dd513b.tar.gz nextcloud-server-c193c0d46670fdda79f74523eb0f616175dd513b.zip |
Merge pull request #16331 from nextcloud/feature/noid/talk-guest-mentions
Allow guest mentions of talk to be parsed
Diffstat (limited to 'lib/private')
-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; } |