Page MenuHomePhabricator

D6761.id22770.diff
No OneTemporary

D6761.id22770.diff

diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js
--- a/keyserver/src/push/send.js
+++ b/keyserver/src/push/send.js
@@ -10,6 +10,7 @@
import uuidv4 from 'uuid/v4.js';
import { oldValidUsernameRegex } from 'lib/shared/account-utils.js';
+import { isMentioned } from 'lib/shared/mention-utils.js';
import {
createMessageInfo,
sortMessageInfoList,
@@ -135,7 +136,7 @@
threadInfo.currentUser.role &&
oldValidUsernameRegex.test(username) &&
firstNewMessageInfo.type === messageTypes.TEXT &&
- new RegExp(`\\B@${username}\\b`, 'i').test(firstNewMessageInfo.text);
+ isMentioned(username, firstNewMessageInfo.text);
if (!updateBadge && !displayBanner && !userWasMentioned) {
continue;
}
diff --git a/lib/shared/mention-utils.js b/lib/shared/mention-utils.js
--- a/lib/shared/mention-utils.js
+++ b/lib/shared/mention-utils.js
@@ -15,6 +15,10 @@
+end: number,
};
+function isMentioned(username: string, text: string): boolean {
+ return new RegExp(`\\B@${username}\\b`, 'i').test(text);
+}
+
function getTypeaheadRegexMatches(
text: string,
selection: Selection,
@@ -69,6 +73,7 @@
}
export {
+ isMentioned,
getTypeaheadUserSuggestions,
getNewTextAndSelection,
getTypeaheadRegexMatches,

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 7:37 PM (19 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2499715
Default Alt Text
D6761.id22770.diff (1 KB)

Event Timeline