mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-24 08:04:11 +08:00
fix(contact-search): Also match domains
Fixes T2468
This commit is contained in:
parent
8661695224
commit
7049d6c474
1 changed files with 7 additions and 2 deletions
|
@ -188,11 +188,16 @@ class ContactStore extends NylasStore
|
||||||
# email addresses
|
# email addresses
|
||||||
return false unless contact.email
|
return false unless contact.email
|
||||||
# - email (bengotow@gmail.com)
|
# - email (bengotow@gmail.com)
|
||||||
|
# - email domain (test@bengotow.com)
|
||||||
# - name parts (Ben, Go)
|
# - name parts (Ben, Go)
|
||||||
# - name full (Ben Gotow)
|
# - name full (Ben Gotow)
|
||||||
# (necessary so user can type more than first name ie: "Ben Go")
|
# (necessary so user can type more than first name ie: "Ben Go")
|
||||||
return true if contact.email?.toLowerCase().indexOf(search) is 0
|
if contact.email
|
||||||
return true if contact.name?.toLowerCase().indexOf(search) is 0
|
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() ? ""
|
name = contact.name?.toLowerCase() ? ""
|
||||||
for namePart in name.split(/\s/)
|
for namePart in name.split(/\s/)
|
||||||
return true if namePart.indexOf(search) is 0
|
return true if namePart.indexOf(search) is 0
|
||||||
|
|
Loading…
Reference in a new issue