Fix room account settings (#7999)

This commit is contained in:
J. Ryan Stinnett 2022-03-07 17:51:20 +00:00 committed by GitHub
parent 9379be0189
commit 3426c3c3cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,15 +100,15 @@ export default class RoomAccountSettingsHandler extends MatrixClientBackedSettin
if (field === null) {
content = value;
} else {
const content = this.getSettings(roomId, eventType) || {};
content = this.getSettings(roomId, eventType) || {};
content[field] = value;
}
await this.client.setRoomAccountData(roomId, eventType, content);
const deferred = defer<void>();
const handler = (event: MatrixEvent) => {
if (event.getRoomId() !== roomId || event.getType() !== eventType) return;
const handler = (event: MatrixEvent, room: Room) => {
if (room.roomId !== roomId || event.getType() !== eventType) return;
if (field !== null && event.getContent()[field] !== value) return;
this.client.off(RoomEvent.AccountData, handler);
deferred.resolve();