Fixed view layouts after deleting a conversation.

pull/28/head
Mikunj 7 years ago
parent 0cf616328e
commit c583819ccf

@ -585,6 +585,13 @@
} }
}); });
Whisper.events.on('deleteConversation', async conversation => {
await conversation.destroyMessages();
await window.Signal.Data.removeConversation(conversation.id, {
Conversation: Whisper.Conversation,
});
});
Whisper.Notifications.on('click', conversation => { Whisper.Notifications.on('click', conversation => {
window.showWindow(); window.showWindow();
if (conversation) { if (conversation) {
@ -602,7 +609,7 @@
if (messageReceiver) { if (messageReceiver) {
messageReceiver.onFriendRequestUpdate(pubKey, message); messageReceiver.onFriendRequestUpdate(pubKey, message);
} }
}) });
Whisper.events.on('showFriendRequest', friendRequest => { Whisper.events.on('showFriendRequest', friendRequest => {
if (appView) { if (appView) {

@ -329,9 +329,7 @@
}; };
const onDelete = async () => { const onDelete = async () => {
await window.Signal.Data.removeConversation(conversation.id, { window.Whisper.events.trigger('deleteConversation', conversation);
Conversation: Whisper.Conversation,
})
}; };
return { return {

@ -37,6 +37,12 @@
} }
conversation.trigger('opened'); conversation.trigger('opened');
}, },
close(conversation) {
const $el = this.$(`#conversation-${conversation.cid}`);
if ($el && $el.length > 0) {
$el.remove();
}
}
}); });
Whisper.FontSizeView = Whisper.View.extend({ Whisper.FontSizeView = Whisper.View.extend({
@ -138,10 +144,12 @@
'add change:timestamp change:name change:number', 'add change:timestamp change:name change:number',
this.inboxListView.updateLocation this.inboxListView.updateLocation
); );
this.inboxListView.listenTo(
// Listen to any conversation remove
this.listenTo(
inboxCollection, inboxCollection,
'remove', 'remove',
this.inboxListView.removeItem this.closeConversation,
); );
this.searchView = new Whisper.ConversationSearchView({ this.searchView = new Whisper.ConversationSearchView({
@ -274,6 +282,12 @@
this.focusConversation(); this.focusConversation();
} }
}, },
closeConversation(conversation) {
if (conversation) {
this.inboxListView.removeItem(conversation);
this.conversation_stack.close(conversation);
}
},
closeRecording(e) { closeRecording(e) {
if (e && this.$(e.target).closest('.capture-audio').length > 0) { if (e && this.$(e.target).closest('.capture-audio').length > 0) {
return; return;

Loading…
Cancel
Save