Page MenuHomePhabricator

D9005.id31258.diff
No OneTemporary

D9005.id31258.diff

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

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)

Event Timeline