From 8da00f9a030bfeca021ece14f70c7c5c29812efd Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 31 Aug 2020 08:53:47 +0200 Subject: [PATCH] add isTrackingMembers flag to know if EncryptionUsers have been written for this room --- src/matrix/room/Room.js | 4 ++++ src/matrix/room/RoomSummary.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/matrix/room/Room.js b/src/matrix/room/Room.js index c7b5e736..17214c3a 100644 --- a/src/matrix/room/Room.js +++ b/src/matrix/room/Room.js @@ -260,6 +260,10 @@ export class Room extends EventEmitter { return !!this._summary.encryption; } + get isTrackingMembers() { + return this._summary.isTrackingMembers; + } + async _getLastEventId() { const lastKey = this._syncWriter.lastMessageKey; if (lastKey) { diff --git a/src/matrix/room/RoomSummary.js b/src/matrix/room/RoomSummary.js index 803aff49..51a31d21 100644 --- a/src/matrix/room/RoomSummary.js +++ b/src/matrix/room/RoomSummary.js @@ -147,6 +147,7 @@ class SummaryData { this.heroes = copy ? copy.heroes : null; this.canonicalAlias = copy ? copy.canonicalAlias : null; this.hasFetchedMembers = copy ? copy.hasFetchedMembers : false; + this.isTrackingMembers = copy ? copy.isTrackingMembers : false; this.lastPaginationToken = copy ? copy.lastPaginationToken : null; this.avatarUrl = copy ? copy.avatarUrl : null; this.notificationCount = copy ? copy.notificationCount : 0; @@ -238,6 +239,10 @@ export class RoomSummary { return this._data.hasFetchedMembers; } + get isTrackingMembers() { + return this._data.isTrackingMembers; + } + get lastPaginationToken() { return this._data.lastPaginationToken; } @@ -262,6 +267,13 @@ export class RoomSummary { return data; } + writeIsTrackingMembers(value, txn) { + const data = new SummaryData(this._data); + data.isTrackingMembers = value; + txn.roomSummary.set(data.serialize()); + return data; + } + writeSync(roomResponse, membership, isInitialSync, isTimelineOpen, txn) { // clear cloned flag, so cloneIfNeeded makes a copy and // this._data is not modified if any field is changed.