mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
Add support for deleting a conversation
Note that the conversation record is not actually destroyed, merely marked inactive, preserving the contact name, photo, etc...
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
'use strict';
|
||||
window.Whisper = window.Whisper || {};
|
||||
|
||||
Whisper.ConversationView = Backbone.View.extend({
|
||||
@@ -39,7 +39,17 @@
|
||||
|
||||
events: {
|
||||
'submit .send': 'sendMessage',
|
||||
'close': 'remove'
|
||||
'close': 'remove',
|
||||
'click .destroy': 'destroyMessages'
|
||||
},
|
||||
|
||||
destroyMessages: function(e) {
|
||||
if (confirm("Permanently delete this conversation?")) {
|
||||
this.model.destroyMessages();
|
||||
this.model.collection.remove(this.model);
|
||||
this.remove();
|
||||
this.model.trigger('destroy');
|
||||
}
|
||||
},
|
||||
|
||||
sendMessage: function(e) {
|
||||
|
||||
@@ -32,7 +32,11 @@
|
||||
collection : this.conversations
|
||||
});
|
||||
|
||||
this.conversations.fetch({reset: true}).then(function() {
|
||||
this.conversations.fetch({ reset: true }).then(function() {
|
||||
this.conversations.reset(
|
||||
//TODO: Add an index to support this operation at the db level
|
||||
this.conversations.filter(function(c) { return c.get('active'); })
|
||||
);
|
||||
if (this.conversations.length) {
|
||||
this.conversations.at(0).trigger('render');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user