From 764cddcdec4d13220fc3d335774ef85958f81244 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 20 Nov 2020 11:45:38 +0100 Subject: [PATCH] can be cached --- src/matrix/room/sending/PendingEvent.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/matrix/room/sending/PendingEvent.js b/src/matrix/room/sending/PendingEvent.js index 554ed06a..1980b30b 100644 --- a/src/matrix/room/sending/PendingEvent.js +++ b/src/matrix/room/sending/PendingEvent.js @@ -38,6 +38,10 @@ export class PendingEvent { this._aborted = false; this._status = SendStatus.Waiting; this._sendRequest = null; + this._attachmentsTotalBytes = 0; + if (this._attachments) { + this._attachmentsTotalBytes = Object.values(this._attachments).reduce((t, a) => t + a.size, 0); + } } get roomId() { return this._data.roomId; } @@ -89,7 +93,7 @@ export class PendingEvent { get error() { return this._error; } get attachmentsTotalBytes() { - return this._attachments && Object.values(this._attachments).reduce((t, a) => t + a.size, 0); + return this._attachmentsTotalBytes; } get attachmentsSentBytes() {