Hide new contact view unless we have no matches.

pull/69/head
Mikunj 7 years ago
parent 1cb09cad2a
commit 08f9101fec

@ -49,7 +49,7 @@ const generateImage = pubKey => {
*/ */
const png = new Identicon(sha224(pubKey), { const png = new Identicon(sha224(pubKey), {
margin: 0.2, margin: 0.2,
background: [0,0,0,0], background: [0, 0, 0, 0],
}).toString(); }).toString();
fs.writeFileSync(imagePath, png, 'base64'); fs.writeFileSync(imagePath, png, 'base64');
return imagePath return imagePath

@ -73,7 +73,7 @@
// Update the contact model // Update the contact model
this.new_contact_view.model.set('id', query); this.new_contact_view.model.set('id', query);
this.new_contact_view.render().$el.show(); this.new_contact_view.render().$el.hide();
this.new_contact_view.validate(); this.new_contact_view.validate();
this.hideHints(); this.hideHints();
@ -89,10 +89,9 @@
// This will allow us to show the last message when searching // This will allow us to show the last message when searching
this.typeahead_view.collection.forEach(c => c.updateLastMessage()); this.typeahead_view.collection.forEach(c => c.updateLastMessage());
// Check if the query is in the model list // Show the new contact view if we already have results
// If it is then hide the new contact view if (this.typeahead_view.collection.length === 0)
const modelExists = this.typeahead_view.collection.find(item => item.get('id') === query); this.new_contact_view.$el.show();
if (modelExists) this.new_contact_view.$el.hide();
}) })
); );
/* eslint-enable more/no-then */ /* eslint-enable more/no-then */

Loading…
Cancel
Save