From 6b52457274424ae463feb96f2aa9868b86fe51cc Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Tue, 1 Mar 2022 12:02:54 +0000 Subject: [PATCH] Don't set global displayname for bot in generic hooks (#215) * Don't set global displayname for bot in generic hooks * Create 215.bugfix --- changelog.d/215.bugfix | 1 + src/Connections/GenericHook.ts | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 changelog.d/215.bugfix diff --git a/changelog.d/215.bugfix b/changelog.d/215.bugfix new file mode 100644 index 00000000..c7a57354 --- /dev/null +++ b/changelog.d/215.bugfix @@ -0,0 +1 @@ +Fixed an issue where the bridge bot would change it's displayname if a webhook event is handled while `generic.userIdPrefix` is not set in the config. diff --git a/src/Connections/GenericHook.ts b/src/Connections/GenericHook.ts index c28c290e..0318dbf7 100644 --- a/src/Connections/GenericHook.ts +++ b/src/Connections/GenericHook.ts @@ -137,6 +137,10 @@ export class GenericHookConnection extends BaseConnection implements IConnection return; } const sender = this.getUserId(); + if (sender === this.as.botUserId) { + // Don't set the global displayname for the bot. + return; + } const intent = this.as.getIntentForUserId(sender); const expectedDisplayname = `${this.state.name} (Webhook)`;