From 3b7078ec9a7cecc712b6162ca31f11feeb91156c Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Fri, 20 Sep 2019 01:22:00 -0500 Subject: [PATCH] narrowsReducer/eventUpdateMessageFlags: Assert operation is add | remove Adds an assertion to match the type in EventUpdateMessageFlagsAction in src/actionTypes.js, so that action.operation can only be 'add' or 'remove'. --- src/chat/narrowsReducer.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/chat/narrowsReducer.js b/src/chat/narrowsReducer.js index 8329b285a7c..ded4fae0de0 100644 --- a/src/chat/narrowsReducer.js +++ b/src/chat/narrowsReducer.js @@ -74,6 +74,8 @@ const eventUpdateMessageFlags = (state, action) => { updates.push({ [narrowStr]: state[narrowStr].filter(id => !messagesSet.has(id)), }); + } else { + throw new Error(`Unexpected operation ${operation} in an EVENT_UPDATE_MESSAGE_FLAGS action`); } }