Improve typeahead contact selector experience
Store and match on various phone number formats. Still not perfect, as occasionally all the models are returned for a non-matching query.
This commit is contained in:
parent
acc2c6f536
commit
d435ff003b
3 changed files with 21 additions and 15 deletions
|
@ -39,13 +39,15 @@
|
|||
var missing = _.filter(required, function(attr) { return !attributes[attr]; });
|
||||
if (missing.length) { return "Conversation must have " + missing; }
|
||||
|
||||
// hack
|
||||
if (this.get('type') === 'private') {
|
||||
var number = libphonenumber.util.verifyNumber(id);
|
||||
this.id = libphonenumber.util.verifyNumber(this.id);
|
||||
var number = libphonenumber.util.splitCountryCode(this.id);
|
||||
|
||||
this.set({
|
||||
id: number,
|
||||
international_number: libphonenumber.format(number, libphonenumber.PhoneNumberFormat.INTERNATIONAL),
|
||||
national_number: libphonenumber.format(number, libphonenumber.PhoneNumberFormat.NATIONAL)
|
||||
e164_number: this.id,
|
||||
national_number: '' + number.national_number,
|
||||
international_number: '' + number.country_code + number.national_number
|
||||
});
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue