Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3349925
D9344.id31603.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
D9344.id31603.diff
View Options
diff --git a/lib/shared/markdown.js b/lib/shared/markdown.js
--- a/lib/shared/markdown.js
+++ b/lib/shared/markdown.js
@@ -235,7 +235,7 @@
} {
const threadInfo = chatMentionCandidates[capture[2]];
const threadName = threadInfo?.uiName ?? decodeChatMentionText(capture[3]);
- const content = `@${threadName}`;
+ const content = `${capture[0][0] !== '@' ? capture[0][0] : ''}@${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,10 @@
function renderChatMentionsWithAltText(text: string): string {
return text.replace(
globalChatMentionRegex,
- (...match) => `@${decodeChatMentionText(match[3])}`,
+ (...match) =>
+ `${match[0][0] !== '@' ? match[0][0] : ''}@${decodeChatMentionText(
+ match[3],
+ )}`,
);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 7:48 PM (19 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2572264
Default Alt Text
D9344.id31603.diff (1 KB)
Attached To
Mode
D9344: [lib] Remove negative lookbehind assertions from chat mention regex
Attached
Detach File
Event Timeline
Log In to Comment