From 202a4fa6f1ae8ad4c7dcdf024ffe27ecff6050cb Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Mon, 10 May 2021 15:55:16 +0100 Subject: [PATCH] Better document new room methods --- src/models/room.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/models/room.js b/src/models/room.js index 5621cff08..cf346f664 100644 --- a/src/models/room.js +++ b/src/models/room.js @@ -228,6 +228,18 @@ function pendingEventsKey(roomId) { utils.inherits(Room, EventEmitter); + +/** + * Bulk decrypt critical events in a room + * + * Critical events represents the minimal set of events to decrypt + * for the UI to function properly + * + * - Last event of every room (to generate message preview) + * - All events are the read receipt (to calculate an accurate notification count) + * + * @returns {Promise} Signals when all events have been decrypted + */ Room.prototype.decryptCriticalEvents = function() { const readReceiptEventId = this.getEventReadUpTo(this._client.getUserId(), true); const events = this.getLiveTimeline().getEvents(); @@ -244,6 +256,11 @@ Room.prototype.decryptCriticalEvents = function() { return Promise.allSettled(decryptionPromises); } +/** + * Bulk decrypt events in a room + * + * @returns {Promise} Signals when all events have been decrypted + */ Room.prototype.decryptAllEvents = function() { const decryptionPromises = this .getUnfilteredTimelineSet()