EventIndex: Simplify the json event getting logic.

pull/21833/head
Damir Jelić 2020-01-20 12:42:46 +01:00
parent b4c8a686ce
commit 0b4b9d8d5d
1 changed files with 2 additions and 8 deletions

View File

@ -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];