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() {
|
destroyMessages: function() {
|
||||||
var models = this.messageCollection.models;
|
this.messageCollection.fetch({
|
||||||
this.messageCollection.reset([]);
|
index: {
|
||||||
_.each(models, function(message) { message.destroy(); });
|
// 'conversation' index on [conversationId, received_at]
|
||||||
this.save({active_at: null, lastMessage: ''}); // archive
|
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() {
|
getTitle: function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue