Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3254275
D6761.id22770.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6761.id22770.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D6761: [keyserver] Extract isMentioned function
Attached
Detach File
Event Timeline
Log In to Comment