[core] ChatWoot - remove @lid when mention it

fix #1803
This commit is contained in:
devlikepro committed 2026-01-15 12:15:06 +07:00
1 parent a57f3443de
commit 52412fb4cc
2 files changed
+13 -1

No files matched your search

@@ -108,8 +108,16 @@ describe('parseMentionsFromText', () => {
it('parses @lid mentions without c.us suffix', () => {
const input = 'Notify @123123@lid now';
expect(parseMentionsFromText(input)).toEqual({
text: 'Notify @123123@lid now',
text: 'Notify @123123 now',
mentions: ['123123@lid'],
});
});
it('replaces @lid suffix with plain ids', () => {
const input = '@123456@lid please ping @654321@lid.';
expect(parseMentionsFromText(input)).toEqual({
text: '@123456 please ping @654321.',
mentions: ['123456@lid', '654321@lid'],
});
});
});
@@ -40,6 +40,10 @@ export function parseMentionsFromText(text: string): ParsedMentions {
mentions.push(formattedLid);
}
}
if (mentions.length > 0) {
const lidRegexReplace = /(^|\s)@(\d{6,15})@lid\b/g;
content = content.replace(lidRegexReplace, '$1@$2').trim();
}
// Regex to match @ followed by phone number
// Matches: @558591203123, @5585991203123, etc.