aboutsummaryrefslogtreecommitdiffstats
path: root/apps/comments/lib/Notification/Notifier.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-01-29 09:46:14 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2021-02-06 13:07:05 +0100
commit1344c61145c2a9eb36c1c211daa9018f00693c7c (patch)
tree46d58bd955a8acb92680319c449b4e3bcbf7d82e /apps/comments/lib/Notification/Notifier.php
parent6945bd8cc388a7a697ef0342d406423f2e545a78 (diff)
downloadnextcloud-server-1344c61145c2a9eb36c1c211daa9018f00693c7c.tar.gz
nextcloud-server-1344c61145c2a9eb36c1c211daa9018f00693c7c.zip
Improve mention matches
The previous regex didn't correctly match users with . ' or - Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/comments/lib/Notification/Notifier.php')
-rw-r--r--apps/comments/lib/Notification/Notifier.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/comments/lib/Notification/Notifier.php b/apps/comments/lib/Notification/Notifier.php
index 9f69e5599f8..20e0667d143 100644
--- a/apps/comments/lib/Notification/Notifier.php
+++ b/apps/comments/lib/Notification/Notifier.php
@@ -195,7 +195,11 @@ class Notifier implements INotifier {
// could contain characters like '@' for user IDs) but a one-based
// index of the mentions of that type.
$mentionParameterId = 'mention-' . $mention['type'] . $mentionTypeCount[$mention['type']];
- $message = str_replace('@' . $mention['id'], '{' . $mentionParameterId . '}', $message);
+ $message = str_replace('@"' . $mention['id'] . '"', '{' . $mentionParameterId . '}', $message);
+ if (strpos($mention['id'], ' ') === false && strpos($mention['id'], 'guest/') !== 0) {
+ $message = str_replace('@' . $mention['id'], '{' . $mentionParameterId . '}', $message);
+ }
+
try {
$displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']);
} catch (\OutOfBoundsException $e) {