From bb02fa3a7edf7f04e4d4033c38b1874e5c7e6436 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Thu, 14 Nov 2019 16:29:39 -0800 Subject: [PATCH] Prevent conversation up/down when showing search results --- js/background.js | 9 +++++---- js/modules/signal.js | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/js/background.js b/js/background.js index 3777ac87f..3da6f3ba0 100644 --- a/js/background.js +++ b/js/background.js @@ -651,6 +651,7 @@ const state = store.getState(); const selectedId = state.conversations.selectedConversation; const conversation = ConversationController.get(selectedId); + const isSearching = Signal.State.Selectors.search.isSearching(state); // NAVIGATION @@ -798,7 +799,7 @@ } // Change currently selected conversation - up/down, to next/previous unread - if (optionOrAlt && !shiftKey && key === 'ArrowUp') { + if (!isSearching && optionOrAlt && !shiftKey && key === 'ArrowUp') { const unreadOnly = false; const targetId = findConversation( conversation ? conversation.id : null, @@ -813,7 +814,7 @@ return; } } - if (optionOrAlt && !shiftKey && key === 'ArrowDown') { + if (!isSearching && optionOrAlt && !shiftKey && key === 'ArrowDown') { const unreadOnly = false; const targetId = findConversation( conversation ? conversation.id : null, @@ -828,7 +829,7 @@ return; } } - if (optionOrAlt && shiftKey && key === 'ArrowUp') { + if (!isSearching && optionOrAlt && shiftKey && key === 'ArrowUp') { const unreadOnly = true; const targetId = findConversation( conversation ? conversation.id : null, @@ -843,7 +844,7 @@ return; } } - if (optionOrAlt && shiftKey && key === 'ArrowDown') { + if (!isSearching && optionOrAlt && shiftKey && key === 'ArrowDown') { const unreadOnly = true; const targetId = findConversation( conversation ? conversation.id : null, diff --git a/js/modules/signal.js b/js/modules/signal.js index a9e2b4423..c6fedcae0 100644 --- a/js/modules/signal.js +++ b/js/modules/signal.js @@ -70,6 +70,7 @@ const stickersDuck = require('../../ts/state/ducks/stickers'); const userDuck = require('../../ts/state/ducks/user'); const conversationsSelectors = require('../../ts/state/selectors/conversations'); +const searchSelectors = require('../../ts/state/selectors/search'); // Migrations const { @@ -286,6 +287,7 @@ exports.setup = (options = {}) => { }; const Selectors = { conversations: conversationsSelectors, + search: searchSelectors, }; const State = {