From f7b2f2854002e38203c4ebffbb5fbeda67569dfe Mon Sep 17 00:00:00 2001 From: Tarrgon <61888458+Tarrgon@users.noreply.github.com> Date: Wed, 13 Aug 2025 11:42:53 -0400 Subject: [PATCH] Fix commas breaking contributor mentions --- src/utils/github-user-utils.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils/github-user-utils.ts b/src/utils/github-user-utils.ts index 3b57dbc..26b68e7 100644 --- a/src/utils/github-user-utils.ts +++ b/src/utils/github-user-utils.ts @@ -1,12 +1,13 @@ import { Database } from '../shared/Database'; -const mentionRegex = new RegExp('@([\\S]+)', 'gi'); +const mentionRegex = new RegExp('@([\\S]+),|@([\\S]+)', 'gi'); export async function fixPings(body: string): Promise { const mappings = await Database.getAllGithubUserMappings(); - return body.replaceAll(mentionRegex, (match, username) => { - const mapping = mappings.find(m => m.github_username == username); + return body.replaceAll(mentionRegex, (match, m1, m2) => { + const name = m1 ?? m2; + const mapping = mappings.find(m => m.github_username == name); return mapping ? `<@${mapping.discord_id}>` : match; });