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:
@@ -155,7 +155,7 @@
|
|||||||
function updateConversation(conversationId) {
|
function updateConversation(conversationId) {
|
||||||
var conversation = ConversationController.get(conversationId);
|
var conversation = ConversationController.get(conversationId);
|
||||||
if (conversation) {
|
if (conversation) {
|
||||||
conversation.fetchMessages();
|
conversation.trigger('newmessages');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -87,7 +87,7 @@
|
|||||||
conversation.fetch();
|
conversation.fetch();
|
||||||
}
|
}
|
||||||
if (inboxOpened) {
|
if (inboxOpened) {
|
||||||
conversation.fetchMessages();
|
conversation.trigger('newmessages');
|
||||||
extension.windows.drawAttention(inboxWindowId);
|
extension.windows.drawAttention(inboxWindowId);
|
||||||
} else if (Whisper.Notifications.isEnabled()) {
|
} else if (Whisper.Notifications.isEnabled()) {
|
||||||
var sender = ConversationController.create({id: message.get('source')});
|
var sender = ConversationController.create({id: message.get('source')});
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
this.listenTo(this.model, 'destroy', this.stopListening);
|
this.listenTo(this.model, 'destroy', this.stopListening);
|
||||||
this.listenTo(this.model, 'change:name', this.updateTitle);
|
this.listenTo(this.model, 'change:name', this.updateTitle);
|
||||||
|
this.listenTo(this.model, 'newmessages', this.fetchMessages);
|
||||||
|
|
||||||
this.render();
|
this.render();
|
||||||
|
|
||||||
@@ -79,6 +80,9 @@
|
|||||||
'select .entry': 'messageDetail',
|
'select .entry': 'messageDetail',
|
||||||
'force-resize': 'forceUpdateMessageFieldSize'
|
'force-resize': 'forceUpdateMessageFieldSize'
|
||||||
},
|
},
|
||||||
|
fetchMessages: function() {
|
||||||
|
this.model.fetchMessages();
|
||||||
|
},
|
||||||
|
|
||||||
viewMembers: function() {
|
viewMembers: function() {
|
||||||
var view = new Whisper.GroupMemberList({ model: this.model });
|
var view = new Whisper.GroupMemberList({ model: this.model });
|
||||||
|
Reference in New Issue
Block a user