Fixed testing issue:

- We previously triggered expect(getMemberDisplayName).not.toHaveBeenCalled();
- We now only fetch the displayName when the message contains a formatted_body, as we only need to search those messages for mentions using displayName
This commit is contained in:
Nick Ludlam 2026-03-26 22:03:24 +00:00 committed by Gustavo Madeira Santana
parent ba1c08cd88
commit 82027b46f7
No known key found for this signature in database
1 changed files with 3 additions and 1 deletions

View File

@ -552,7 +552,9 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
resolveAgentRoute: core.channel.routing.resolveAgentRoute,
});
const agentMentionRegexes = core.channel.mentions.buildMentionRegexes(cfg, _route.agentId);
const selfDisplayName = await getMemberDisplayName(roomId, selfUserId).catch(() => undefined);
const selfDisplayName = content.formatted_body
? await getMemberDisplayName(roomId, selfUserId).catch(() => undefined)
: undefined;
const { wasMentioned, hasExplicitMention } = resolveMentions({
content,
userId: selfUserId,