Search view now works with deleting contacts as well

pull/252/head
Beaudan 6 years ago
parent df93c97b48
commit 5c29c6cb1d

@ -115,6 +115,9 @@
window.getContactCollection = () => contactCollection;
window.ConversationController = {
getCollection() {
return conversations;
},
markAsSelected(toSelect) {
conversations.each(conversation => {
const current = conversation.isSelected || false;
@ -209,17 +212,11 @@
return conversation;
},
async deleteContact(id, type) {
async deleteContact(id) {
if (typeof id !== 'string') {
throw new TypeError("'id' must be a string");
}
if (type !== 'private' && type !== 'group') {
throw new TypeError(
`'type' must be 'private' or 'group'; got: '${type}'`
);
}
if (!this._initialFetchComplete) {
throw new Error(
'ConversationController.get() needs complete initial fetch'
@ -230,7 +227,6 @@
if (!conversation) {
return;
}
conversations.remove(conversation);
await conversation.destroyMessages();
const deviceIds = await textsecure.storage.protocol.getDeviceIds(id);
await Promise.all(
@ -246,6 +242,7 @@
await window.Signal.Data.removeConversation(id, {
Conversation: Whisper.Conversation,
});
conversations.remove(conversation);
},
getOrCreateAndWait(id, type) {
return this._initialPromise.then(() => {

@ -32,11 +32,7 @@
onDeleteContact: () => {
Whisper.events.trigger('showConfirmationDialog', {
message: i18n('deleteContactConfirmation'),
onOk: () =>
ConversationController.deleteContact(
this.model.id,
this.model.get('type')
),
onOk: () => ConversationController.deleteContact(this.model.id),
});
},
onDeleteMessages: () => {

@ -1452,10 +1452,7 @@
Whisper.events.trigger('showConfirmationDialog', {
message: i18n('deleteContactConfirmation'),
onOk: () => {
ConversationController.deleteContact(
this.model.id,
this.model.get('type')
);
ConversationController.deleteContact(this.model.id);
this.remove();
},
});

@ -180,6 +180,12 @@
input: this.$('input.search'),
});
this.searchView.listenTo(
ConversationController.getCollection(),
'remove',
this.searchView.filterContacts
);
this.searchView.$el.hide();
this.listenTo(this.searchView, 'hide', function toggleVisibility() {

Loading…
Cancel
Save