Conversation.notify(): introduce a promise to track completion
FREEBIE
This commit is contained in:
parent
d3fb0e5b46
commit
32e12f7d3c
1 changed files with 20 additions and 14 deletions
|
@ -815,16 +815,19 @@
|
||||||
|
|
||||||
notify: function(message) {
|
notify: function(message) {
|
||||||
if (!message.isIncoming()) {
|
if (!message.isIncoming()) {
|
||||||
return;
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
if (window.isOpen() && window.isFocused()) {
|
if (window.isOpen() && window.isFocused()) {
|
||||||
return;
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.drawAttention();
|
window.drawAttention();
|
||||||
var sender = ConversationController.create({
|
var sender = ConversationController.create({
|
||||||
id: message.get('source'), type: 'private'
|
id: message.get('source'), type: 'private'
|
||||||
});
|
});
|
||||||
var conversationId = this.id;
|
var conversationId = this.id;
|
||||||
|
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
sender.fetch().then(function() {
|
sender.fetch().then(function() {
|
||||||
sender.getNotificationIcon().then(function(iconUrl) {
|
sender.getNotificationIcon().then(function(iconUrl) {
|
||||||
console.log('adding notification');
|
console.log('adding notification');
|
||||||
|
@ -836,7 +839,10 @@
|
||||||
conversationId : conversationId,
|
conversationId : conversationId,
|
||||||
messageId : message.id
|
messageId : message.id
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
return resolve();
|
||||||
|
}, reject);
|
||||||
|
}, reject);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
hashCode: function() {
|
hashCode: function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue