Validate/reformat phone numbers in contact syncs
Turns out there's no garauntee that Android will send us contact info with phone numbers in e164 format. When that happens, we fail to update the correct contact. Fix by performing validation on the incoming number before attempting to merge changes to the name, avatar, or color. Fixes #903
This commit is contained in:
parent
59c684db8a
commit
f2bdafc7e9
1 changed files with 10 additions and 2 deletions
|
@ -128,14 +128,22 @@
|
|||
|
||||
function onContactReceived(ev) {
|
||||
var contactDetails = ev.contactDetails;
|
||||
ConversationController.create({
|
||||
|
||||
var c = new Whisper.Conversation({
|
||||
name: contactDetails.name,
|
||||
id: contactDetails.number,
|
||||
avatar: contactDetails.avatar,
|
||||
color: contactDetails.color,
|
||||
type: 'private',
|
||||
active_at: Date.now()
|
||||
}).save();
|
||||
});
|
||||
var error;
|
||||
if (error = c.validateNumber()) {
|
||||
console.log(error);
|
||||
return;
|
||||
}
|
||||
|
||||
ConversationController.create(c).save();
|
||||
}
|
||||
|
||||
function onGroupReceived(ev) {
|
||||
|
|
Loading…
Reference in a new issue