Skip to content

Commit

Permalink
Merge pull request Expensify#41292 from tienifr/fix/40205
Browse files Browse the repository at this point in the history
fix: shorthand mention in backtick
  • Loading branch information
robertjchen authored May 13, 2024
2 parents 59e74e9 + 0ae4db1 commit f443efa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@ const CONST = {

POLICY_ID_FROM_PATH: /\/w\/([a-zA-Z0-9]+)(\/|$)/,

SHORT_MENTION: new RegExp(`@[\\w\\-\\+\\'#@]+(?:\\.[\\w\\-\\'\\+]+)*`, 'gim'),
SHORT_MENTION: new RegExp(`@[\\w\\-\\+\\'#@]+(?:\\.[\\w\\-\\'\\+]+)*(?![^\`]*\`)`, 'gim'),
},

PRONOUNS: {
Expand Down
3 changes: 3 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3361,6 +3361,9 @@ function getParsedComment(text: string, parsingDetails?: ParsingDetails): string

const parser = new ExpensiMark();
const textWithMention = text.replace(CONST.REGEX.SHORT_MENTION, (match) => {
if (!Str.isValidMention(match)) {
return match;
}
const mention = match.substring(1);
const mentionWithDomain = addDomainToShortMention(mention);
return mentionWithDomain ? `@${mentionWithDomain}` : match;
Expand Down

0 comments on commit f443efa

Please sign in to comment.