Fix MatrixClient access in settings
parent
9c8682428f
commit
ae3eb3da9c
|
@ -44,7 +44,7 @@ export default abstract class MatrixClientBackedSettingsHandler extends Settings
|
||||||
}
|
}
|
||||||
|
|
||||||
public get client(): MatrixClient {
|
public get client(): MatrixClient {
|
||||||
return MatrixClientBackedSettingsHandler.matrixClient;
|
return MatrixClientBackedSettingsHandler._matrixClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected initMatrixClient(oldClient: MatrixClient, newClient: MatrixClient) {
|
protected initMatrixClient(oldClient: MatrixClient, newClient: MatrixClient) {
|
||||||
|
|
|
@ -34,13 +34,13 @@ export default class RoomSettingsHandler extends MatrixClientBackedSettingsHandl
|
||||||
|
|
||||||
protected initMatrixClient(oldClient: MatrixClient, newClient: MatrixClient) {
|
protected initMatrixClient(oldClient: MatrixClient, newClient: MatrixClient) {
|
||||||
if (oldClient) {
|
if (oldClient) {
|
||||||
oldClient.removeListener("RoomState.events", this._onEvent);
|
oldClient.removeListener("RoomState.events", this.onEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
newClient.on("RoomState.events", this._onEvent);
|
newClient.on("RoomState.events", this.onEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _onEvent = (event: MatrixEvent, state: RoomState, prevEvent: MatrixEvent) => {
|
private onEvent = (event: MatrixEvent, state: RoomState, prevEvent: MatrixEvent) => {
|
||||||
const roomId = event.getRoomId();
|
const roomId = event.getRoomId();
|
||||||
const room = this.client.getRoom(roomId);
|
const room = this.client.getRoom(roomId);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue