From 8d9fbdb3df4360fb800015926a77eb2e998b1998 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Mon, 5 Nov 2018 16:13:38 +1100 Subject: [PATCH 1/3] 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 */ From 28f6992085eeedbc352dcd04de08529ee137ce62 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Mon, 5 Nov 2018 16:38:51 +1100 Subject: [PATCH 2/3] Replaced var with const. --- js/views/conversation_search_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/views/conversation_search_view.js b/js/views/conversation_search_view.js index 871b4d559..98ba719c2 100644 --- a/js/views/conversation_search_view.js +++ b/js/views/conversation_search_view.js @@ -87,7 +87,7 @@ // 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); + const modelExists = this.typeahead_view.collection.find(item => item.get('id') == query); if (modelExists) this.new_contact_view.$el.hide(); }) ); From 61d15fdd57e4c7de0d865e65c3753cf21b5afe0c Mon Sep 17 00:00:00 2001 From: Mikunj Date: Wed, 7 Nov 2018 13:20:52 +1100 Subject: [PATCH 3/3] Changed == to === --- js/views/conversation_search_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/views/conversation_search_view.js b/js/views/conversation_search_view.js index 98ba719c2..3618585bd 100644 --- a/js/views/conversation_search_view.js +++ b/js/views/conversation_search_view.js @@ -87,7 +87,7 @@ // Check if the query is in the model list // If it is then hide the new contact view - const modelExists = this.typeahead_view.collection.find(item => item.get('id') == query); + const modelExists = this.typeahead_view.collection.find(item => item.get('id') === query); if (modelExists) this.new_contact_view.$el.hide(); }) );