mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 21:19:13 +00:00
* Fix #598 If the bot has PL 0, the bot incorrectly used the default power level. * Create 755.bugfix
This commit is contained in:
parent
b91ca94249
commit
00771d88c3
1
changelog.d/755.bugfix
Normal file
1
changelog.d/755.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Fix setup issues when the bot has PL 0 and room default isn't 0.
|
@ -1143,9 +1143,9 @@ export class Bridge {
|
||||
if (this.config.widgets?.roomSetupWidget?.addOnInvite && event.type === "m.room.power_levels" && event.state_key === "" && !this.connectionManager.isRoomConnected(roomId)) {
|
||||
log.debug(`${roomId} got a new powerlevel change and isn't connected to any connections, testing to see if we should create a setup widget`)
|
||||
const plEvent = new PowerLevelsEvent(event);
|
||||
const currentPl = plEvent.content.users?.[botUser.userId] || plEvent.defaultUserLevel;
|
||||
const previousPl = plEvent.previousContent?.users?.[botUser.userId] || plEvent.previousContent?.users_default;
|
||||
const requiredPl = plEvent.content.events?.["im.vector.modular.widgets"] || plEvent.defaultStateEventLevel;
|
||||
const currentPl = plEvent.content.users?.[botUser.userId] ?? plEvent.defaultUserLevel;
|
||||
const previousPl = plEvent.previousContent?.users?.[botUser.userId] ?? plEvent.previousContent?.users_default;
|
||||
const requiredPl = plEvent.content.events?.["im.vector.modular.widgets"] ?? plEvent.defaultStateEventLevel;
|
||||
if (currentPl !== previousPl && currentPl >= requiredPl) {
|
||||
// PL changed for bot user, check to see if the widget can be created.
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user