some tabs in here

This commit is contained in:
Bruno Windels 2020-09-23 18:22:51 +02:00
parent 64f657e5a2
commit 7cad3b2bdb

View file

@ -34,15 +34,15 @@ import {DecryptionSource} from "../e2ee/common.js";
const EVENT_ENCRYPTED_TYPE = "m.room.encrypted"; const EVENT_ENCRYPTED_TYPE = "m.room.encrypted";
export class Room extends EventEmitter { export class Room extends EventEmitter {
constructor({roomId, storage, hsApi, mediaRepository, emitCollectionChange, pendingEvents, user, createRoomEncryption, getSyncToken, clock}) { constructor({roomId, storage, hsApi, mediaRepository, emitCollectionChange, pendingEvents, user, createRoomEncryption, getSyncToken, clock}) {
super(); super();
this._roomId = roomId; this._roomId = roomId;
this._storage = storage; this._storage = storage;
this._hsApi = hsApi; this._hsApi = hsApi;
this._mediaRepository = mediaRepository; this._mediaRepository = mediaRepository;
this._summary = new RoomSummary(roomId); this._summary = new RoomSummary(roomId);
this._fragmentIdComparer = new FragmentIdComparer([]); this._fragmentIdComparer = new FragmentIdComparer([]);
this._syncWriter = new SyncWriter({roomId, fragmentIdComparer: this._fragmentIdComparer}); this._syncWriter = new SyncWriter({roomId, fragmentIdComparer: this._fragmentIdComparer});
this._emitCollectionChange = emitCollectionChange; this._emitCollectionChange = emitCollectionChange;
this._sendQueue = new SendQueue({roomId, storage, hsApi, pendingEvents}); this._sendQueue = new SendQueue({roomId, storage, hsApi, pendingEvents});
this._timeline = null; this._timeline = null;
@ -53,7 +53,7 @@ export class Room extends EventEmitter {
this._roomEncryption = null; this._roomEncryption = null;
this._getSyncToken = getSyncToken; this._getSyncToken = getSyncToken;
this._clock = clock; this._clock = clock;
} }
_readRetryDecryptCandidateEntries(sinceEventKey, txn) { _readRetryDecryptCandidateEntries(sinceEventKey, txn) {
if (sinceEventKey) { if (sinceEventKey) {
@ -204,7 +204,7 @@ export class Room extends EventEmitter {
/** @package */ /** @package */
async writeSync(roomResponse, isInitialSync, {summaryChanges, decryptChanges, roomEncryption}, txn) { async writeSync(roomResponse, isInitialSync, {summaryChanges, decryptChanges, roomEncryption}, txn) {
const {entries, newLiveKey, memberChanges} = const {entries, newLiveKey, memberChanges} =
await this._syncWriter.writeSync(roomResponse, txn); await this._syncWriter.writeSync(roomResponse, txn);
if (decryptChanges) { if (decryptChanges) {
const decryption = await decryptChanges.write(txn); const decryption = await decryptChanges.write(txn);
@ -286,7 +286,7 @@ export class Room extends EventEmitter {
if (removedPendingEvents) { if (removedPendingEvents) {
this._sendQueue.emitRemovals(removedPendingEvents); this._sendQueue.emitRemovals(removedPendingEvents);
} }
} }
needsAfterSyncCompleted({memberChanges}) { needsAfterSyncCompleted({memberChanges}) {
return this._roomEncryption?.needsToShareKeys(memberChanges); return this._roomEncryption?.needsToShareKeys(memberChanges);
@ -321,7 +321,7 @@ export class Room extends EventEmitter {
} }
/** @package */ /** @package */
async load(summary, txn) { async load(summary, txn) {
try { try {
this._summary.load(summary); this._summary.load(summary);
if (this._summary.data.encryption) { if (this._summary.data.encryption) {
@ -338,7 +338,7 @@ export class Room extends EventEmitter {
} catch (err) { } catch (err) {
throw new WrappedError(`Could not load room ${this._roomId}`, err); throw new WrappedError(`Could not load room ${this._roomId}`, err);
} }
} }
/** @public */ /** @public */
sendEvent(eventType, content) { sendEvent(eventType, content) {