Fix "Delete Messages" not deleting all messages
Since the introduction of infinite scroll, the delete messages function has only deleted the currently loaded set of messages in a conversation. To fix this, we should fetch all the messages and then delete them. Fixes #645 // FREEBIE
This commit is contained in:
parent
26df196aba
commit
137b992f87
1 changed files with 13 additions and 4 deletions
|
@ -218,10 +218,19 @@
|
|||
},
|
||||
|
||||
destroyMessages: function() {
|
||||
var models = this.messageCollection.models;
|
||||
this.messageCollection.reset([]);
|
||||
_.each(models, function(message) { message.destroy(); });
|
||||
this.save({active_at: null, lastMessage: ''}); // archive
|
||||
this.messageCollection.fetch({
|
||||
index: {
|
||||
// 'conversation' index on [conversationId, received_at]
|
||||
name : 'conversation',
|
||||
lower : [this.id],
|
||||
upper : [this.id, Number.MAX_VALUE],
|
||||
}
|
||||
}).then(function() {
|
||||
var models = this.messageCollection.models;
|
||||
this.messageCollection.reset([]);
|
||||
_.each(models, function(message) { message.destroy(); });
|
||||
this.save({active_at: null, lastMessage: ''}); // archive
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
getTitle: function() {
|
||||
|
|
Loading…
Reference in a new issue