From 7049d6c474eb91fe076e5e9fab44085b48728bd0 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Thu, 6 Aug 2015 10:45:17 -0700 Subject: [PATCH] fix(contact-search): Also match domains Fixes T2468 --- src/flux/stores/contact-store.coffee | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/flux/stores/contact-store.coffee b/src/flux/stores/contact-store.coffee index 2470107fb..a9d44a225 100644 --- a/src/flux/stores/contact-store.coffee +++ b/src/flux/stores/contact-store.coffee @@ -188,11 +188,16 @@ class ContactStore extends NylasStore # email addresses return false unless contact.email # - email (bengotow@gmail.com) + # - email domain (test@bengotow.com) # - name parts (Ben, Go) # - name full (Ben Gotow) # (necessary so user can type more than first name ie: "Ben Go") - return true if contact.email?.toLowerCase().indexOf(search) is 0 - return true if contact.name?.toLowerCase().indexOf(search) is 0 + if contact.email + i = contact.email.toLowerCase().indexOf(search) + return true if i is 0 or i is contact.email.indexOf('@') + 1 + if contact.name + return true if contact.name.toLowerCase().indexOf(search) is 0 + name = contact.name?.toLowerCase() ? "" for namePart in name.split(/\s/) return true if namePart.indexOf(search) is 0