parent
e16d80d9a2
commit
b14667ae40
2 changed files with 25 additions and 10 deletions
|
@ -193,7 +193,8 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConversationController.findOrCreateById(id, 'private').then(function(conversation) {
|
return ConversationController.findOrCreateById(id, 'private')
|
||||||
|
.then(function(conversation) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
conversation.save({
|
conversation.save({
|
||||||
name: details.name,
|
name: details.name,
|
||||||
|
@ -202,7 +203,14 @@
|
||||||
active_at: conversation.get('active_at') || Date.now(),
|
active_at: conversation.get('active_at') || Date.now(),
|
||||||
}).then(resolve, reject);
|
}).then(resolve, reject);
|
||||||
});
|
});
|
||||||
}).then(ev.confirm);
|
})
|
||||||
|
.then(ev.confirm)
|
||||||
|
.catch(function(error) {
|
||||||
|
console.log(
|
||||||
|
'onContactReceived error:',
|
||||||
|
error && error.stack ? error.stack : error
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onGroupReceived(ev) {
|
function onGroupReceived(ev) {
|
||||||
|
|
|
@ -104,7 +104,14 @@
|
||||||
conversation.fetch().then(function() {
|
conversation.fetch().then(function() {
|
||||||
resolve(conversation);
|
resolve(conversation);
|
||||||
}, function() {
|
}, function() {
|
||||||
conversation.save().then(function() {
|
var deferred = conversation.save();
|
||||||
|
|
||||||
|
if (!deferred) {
|
||||||
|
console.log('Conversation save failed! ', id, type);
|
||||||
|
return reject(new Error('findOrCreateById: Conversation save failed'));
|
||||||
|
}
|
||||||
|
|
||||||
|
deferred.then(function() {
|
||||||
resolve(conversation);
|
resolve(conversation);
|
||||||
}, reject);
|
}, reject);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue