summaryrefslogtreecommitdiffstats
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
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-02-11 09:35:36 +0000
commit8e43331d4719ee23f0f923f0cd66dc7b59e636ab (patch)
treeec5f96007c57760ea12ac592485801c4c8924390 /apps/comments/lib/Notification/Notifier.php
parent1afa1360608cf5bdd8f197c523ceb21d92c9d758 (diff)
downloadnextcloud-server-8e43331d4719ee23f0f923f0cd66dc7b59e636ab.tar.gz
nextcloud-server-8e43331d4719ee23f0f923f0cd66dc7b59e636ab.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) {