Page MenuHomePhabricator

D9344.diff
No OneTemporary

D9344.diff

diff --git a/lib/shared/markdown.js b/lib/shared/markdown.js
--- a/lib/shared/markdown.js
+++ b/lib/shared/markdown.js
@@ -233,9 +233,9 @@
content: string,
hasAccessToChat: boolean,
} {
- const threadInfo = chatMentionCandidates[capture[2]];
- const threadName = threadInfo?.uiName ?? decodeChatMentionText(capture[3]);
- const content = `@${threadName}`;
+ const threadInfo = chatMentionCandidates[capture[3]];
+ const threadName = threadInfo?.uiName ?? decodeChatMentionText(capture[4]);
+ const content = `${capture[1]}@${threadName}`;
return {
threadInfo,
content,
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,7 +58,7 @@
'g',
);
-const chatMentionRegexString = `(?<!\\\\)(@\\[\\[(${idSchemaRegex}):(.{1,${chatNameMaxLength}}?)(?<!\\\\)\\]\\])`;
+const chatMentionRegexString = `([^\\\\]|^)(@\\[\\[(${idSchemaRegex}):((.{0,${chatNameMaxLength}}?)(?!\\\\).|^)\\]\\])`;
const chatMentionRegex: RegExp = new RegExp(`^${chatMentionRegexString}`);
const globalChatMentionRegex: RegExp = new RegExp(chatMentionRegexString, 'g');
@@ -77,7 +77,7 @@
function renderChatMentionsWithAltText(text: string): string {
return text.replace(
globalChatMentionRegex,
- (...match) => `@${decodeChatMentionText(match[3])}`,
+ (...match) => `${match[1]}@${decodeChatMentionText(match[4])}`,
);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 27, 3:16 AM (21 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2587491
Default Alt Text
D9344.diff (1 KB)

Event Timeline