Don't fetch messages from the background

Only fetch them from a frontend view. If the conversation is not open,
we don't need to load the messages, and if we do load them, they will
render before we've done the initial contact info loading (as
implemented in 74e96ce).

Fixes #344

// FREEBIE
This commit is contained in:
lilia 2015-09-14 13:47:47 -07:00
parent bd5f43bdb1
commit d89e3ccdc4
3 changed files with 6 additions and 2 deletions

View file

@ -155,7 +155,7 @@
function updateConversation(conversationId) {
var conversation = ConversationController.get(conversationId);
if (conversation) {
conversation.fetchMessages();
conversation.trigger('newmessages');
}
}

View file

@ -87,7 +87,7 @@
conversation.fetch();
}
if (inboxOpened) {
conversation.fetchMessages();
conversation.trigger('newmessages');
extension.windows.drawAttention(inboxWindowId);
} else if (Whisper.Notifications.isEnabled()) {
var sender = ConversationController.create({id: message.get('source')});

View file

@ -23,6 +23,7 @@
initialize: function(options) {
this.listenTo(this.model, 'destroy', this.stopListening);
this.listenTo(this.model, 'change:name', this.updateTitle);
this.listenTo(this.model, 'newmessages', this.fetchMessages);
this.render();
@ -79,6 +80,9 @@
'select .entry': 'messageDetail',
'force-resize': 'forceUpdateMessageFieldSize'
},
fetchMessages: function() {
this.model.fetchMessages();
},
viewMembers: function() {
var view = new Whisper.GroupMemberList({ model: this.model });