add isTrackingMembers flag to know if EncryptionUsers have been written

for this room
This commit is contained in:
Bruno Windels 2020-08-31 08:53:47 +02:00
parent d813e6d932
commit 8da00f9a03
2 changed files with 16 additions and 0 deletions

View file

@ -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) {

View file

@ -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.