Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3048521
D9005.id31258.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
D9005.id31258.diff
View Options
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
@@ -58,8 +58,9 @@
'g',
);
-const chatMentionRegexString = `^(?<!\\\\)(@\\[\\[(${idSchemaRegex}):(.{1,${chatNameMaxLength}}?)(?<!\\\\)\\]\\])`;
-const chatMentionRegex: RegExp = new RegExp(chatMentionRegexString);
+const chatMentionRegexString = `(?<!\\\\)(@\\[\\[(${idSchemaRegex}):(.{1,${chatNameMaxLength}}?)(?<!\\\\)\\]\\])`;
+const chatMentionRegex: RegExp = new RegExp(`^${chatMentionRegexString}`);
+const globalChatMentionRegex: RegExp = new RegExp(chatMentionRegexString, 'g');
function encodeChatMentionText(text: string): string {
return text.replace(/]/g, '\\]');
@@ -73,6 +74,10 @@
return `@[[${threadInfo.id}:${encodeChatMentionText(threadInfo.uiName)}]]`;
}
+function renderChatMentionsWithAltText(text: string): string {
+ return text.replace(globalChatMentionRegex, '@$3');
+}
+
function extractUserMentionsFromText(text: string): string[] {
const iterator = text.matchAll(userMentionsExtractionRegex);
return [...iterator].map(matches => matches[2]);
@@ -187,4 +192,5 @@
encodeChatMentionText,
decodeChatMentionText,
getRawChatMention,
+ renderChatMentionsWithAltText,
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 23, 11:28 PM (22 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2354785
Default Alt Text
D9005.id31258.diff (1 KB)
Attached To
Mode
D9005: [lib] Introduce chat mention utilities for plain text
Attached
Detach File
Event Timeline
Log In to Comment