ConversationStack: Unset lastConversation on model unload
This commit is contained in:
parent
86864279b2
commit
05439c6cd6
2 changed files with 10 additions and 8 deletions
|
@ -29,6 +29,9 @@
|
|||
model: conversation,
|
||||
window: this.model.window,
|
||||
});
|
||||
this.listenTo(conversation, 'unload', () =>
|
||||
this.onUnload(conversation)
|
||||
);
|
||||
view.$el.appendTo(this.el);
|
||||
|
||||
if (this.lastConversation) {
|
||||
|
@ -36,6 +39,8 @@
|
|||
'unload',
|
||||
'opened another conversation'
|
||||
);
|
||||
this.stopListening(this.lastConversation);
|
||||
this.lastConversation = null;
|
||||
}
|
||||
|
||||
this.lastConversation = conversation;
|
||||
|
@ -47,8 +52,9 @@
|
|||
// Make sure poppers are positioned properly
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
},
|
||||
onUnload(conversationId) {
|
||||
if (this.lastConversation.id === conversationId) {
|
||||
onUnload(conversation) {
|
||||
if (this.lastConversation === conversation) {
|
||||
this.stopListening(this.lastConversation);
|
||||
this.lastConversation = null;
|
||||
}
|
||||
},
|
||||
|
@ -80,9 +86,6 @@
|
|||
el: this.$('.conversation-stack'),
|
||||
model: { window: options.window },
|
||||
});
|
||||
Whisper.events.on('unloadConversation', conversationId => {
|
||||
this.conversation_stack.onUnload(conversationId);
|
||||
});
|
||||
|
||||
if (!options.initialLoadComplete) {
|
||||
this.appLoadingScreen = new Whisper.AppLoadingScreen();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue