From 7f71e551da203a7412df01bd167dd89e57a4e840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 19 Feb 2020 14:36:21 +0100 Subject: [PATCH] EventIndex: Split out the statements that check for a valid event type. --- src/indexing/EventIndex.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/indexing/EventIndex.js b/src/indexing/EventIndex.js index 1d85d83f07..c8a9a4c1fa 100644 --- a/src/indexing/EventIndex.js +++ b/src/indexing/EventIndex.js @@ -251,13 +251,8 @@ export default class EventIndex extends EventEmitter { * otherwise. */ isValidEvent(ev) { - const validEventType = ([ - "m.room.message", - "m.room.name", - "m.room.topic", - ].indexOf(ev.getType()) >= 0 - && !ev.isRedacted() && !ev.isDecryptionFailure() - ); + const isUsefulType = ["m.room.message", "m.room.name", "m.room.topic"].includes(ev.getType()); + const validEventType = isUsefulType && !ev.isRedacted() && !ev.isDecryptionFailure(); let validMsgType = true;