Wire up end session and leave group

Closes #136
Closes #137
This commit is contained in:
lilia 2015-02-12 20:36:44 -08:00
parent 85b4643e9b
commit 488f25635d
2 changed files with 26 additions and 0 deletions

View file

@ -106,6 +106,19 @@
});
},
endSession: function() {
if (this.get('type') === 'private') {
textsecure.messaging.closeSession(this.id);
}
},
leaveGroup: function() {
if (this.get('type') === 'group') {
textsecure.messaging.leaveGroup(this.id);
}
},
receiveMessage: function(decrypted) {
var conversation = this;
var timestamp = decrypted.pushMessage.timestamp.toNumber();

View file

@ -52,12 +52,24 @@
'submit .send': 'sendMessage',
'close': 'remove',
'click .destroy': 'destroyMessages',
'click .end-session': 'endSession',
'click .leave-group': 'leaveGroup',
'click .new-group-update': 'newGroupUpdate',
'click .settings-btn': 'toggleSettings',
'click .go-back': 'toggleSettings',
'click .hamburger': 'toggleMenu'
},
endSession: function() {
this.model.endSession();
this.$el.find('.menu-list').hide();
},
leaveGroup: function() {
this.model.leaveGroup();
this.$el.find('.menu-list').hide();
},
toggleMenu: function() {
this.$el.find('.menu-list').toggle();
},
@ -80,6 +92,7 @@
this.remove();
this.model.trigger('destroy');
}
this.$el.find('.menu-list').hide();
},
sendMessage: function(e) {