From 8d9fbdb3df4360fb800015926a77eb2e998b1998 Mon Sep 17 00:00:00 2001 From: Mikunj <mikunj@live.com.au> Date: Mon, 5 Nov 2018 16:13:38 +1100 Subject: [PATCH] Fix create conversation appearing even if you already have a conversation with the contact. --- js/views/conversation_search_view.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/views/conversation_search_view.js b/js/views/conversation_search_view.js index 774500752..871b4d559 100644 --- a/js/views/conversation_search_view.js +++ b/js/views/conversation_search_view.js @@ -84,6 +84,11 @@ this.typeahead_view.collection.reset( this.typeahead.filter(isSearchable) ); + + // Check if the query is in the model list + // If it is then hide the new contact view + var modelExists = this.typeahead_view.collection.find(item => item.get('id') == query); + if (modelExists) this.new_contact_view.$el.hide(); }) ); /* eslint-enable more/no-then */