Remove an extension.trigger
No need to trigger an extension-wide event now that all our models live in the background page. We can just update them more or less directly.
This commit is contained in:
parent
626b63ee7c
commit
06e8e0dca7
2 changed files with 12 additions and 3 deletions
|
@ -218,9 +218,10 @@
|
||||||
var deliveries = message.get('delivered') || 0;
|
var deliveries = message.get('delivered') || 0;
|
||||||
var conversationId = message.get('conversationId');
|
var conversationId = message.get('conversationId');
|
||||||
if (conversationId === pushMessage.source || groups.get(conversationId)) {
|
if (conversationId === pushMessage.source || groups.get(conversationId)) {
|
||||||
message.save({delivered: deliveries + 1}).then(function() {
|
message.save({delivered: deliveries + 1}).then(
|
||||||
extension.trigger('message', message); // notify frontend listeners
|
// notify frontend listeners
|
||||||
});
|
updateConversation.bind(window,conversationId)
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
// TODO: consider keeping a list of numbers we've
|
// TODO: consider keeping a list of numbers we've
|
||||||
// successfully delivered to?
|
// successfully delivered to?
|
||||||
|
|
|
@ -29,6 +29,14 @@
|
||||||
return conversations.get(windowMap.modelIdFrom(windowId));
|
return conversations.get(windowMap.modelIdFrom(windowId));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.updateConversation = function(conversationId) {
|
||||||
|
var conversation = conversations.get(conversationId)
|
||||||
|
if (conversation) {
|
||||||
|
conversation.fetch();
|
||||||
|
conversation.fetchMessages();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function closeConversation (windowId) {
|
function closeConversation (windowId) {
|
||||||
windowMap.remove('windowId', windowId);
|
windowMap.remove('windowId', windowId);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue