From 0b4b9d8d5d166ed7454b7d729fc5a08478ac6fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Mon, 20 Jan 2020 12:42:46 +0100 Subject: [PATCH] EventIndex: Simplify the json event getting logic. --- src/indexing/EventIndex.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/indexing/EventIndex.js b/src/indexing/EventIndex.js index 67a3d4cace..e361f66edc 100644 --- a/src/indexing/EventIndex.js +++ b/src/indexing/EventIndex.js @@ -172,10 +172,7 @@ export default class EventIndex { } const jsonEvent = ev.toJSON(); - - let e; - if (ev.isEncrypted()) e = jsonEvent.decrypted; - else e = jsonEvent; + const e = ev.isEncrypted() ? jsonEvent.decrypted: jsonEvent; const profile = { displayname: ev.sender.rawDisplayName, @@ -311,10 +308,7 @@ export default class EventIndex { // consume. const events = filteredEvents.map((ev) => { const jsonEvent = ev.toJSON(); - - let e; - if (ev.isEncrypted()) e = jsonEvent.decrypted; - else e = jsonEvent; + const e = ev.isEncrypted() ? jsonEvent.decrypted: jsonEvent; let profile = {}; if (e.sender in profiles) profile = profiles[e.sender];