Render leave-group messages correctly
This commit is contained in:
parent
367421d40a
commit
85bec04010
2 changed files with 24 additions and 13 deletions
|
@ -148,8 +148,8 @@
|
|||
var conversation = new Whisper.Conversation({id: conversationId});
|
||||
var attributes = {};
|
||||
conversation.fetch().always(function() {
|
||||
if (pushMessageContent.group &&
|
||||
pushMessageContent.group.type === textsecure.protobuf.PushMessageContent.GroupContext.Type.UPDATE) {
|
||||
if (pushMessageContent.group) {
|
||||
if (pushMessageContent.group.type === textsecure.protobuf.PushMessageContent.GroupContext.Type.UPDATE) {
|
||||
attributes = {
|
||||
type : 'group',
|
||||
groupId : pushMessageContent.group.id,
|
||||
|
@ -162,6 +162,12 @@
|
|||
if (difference.length > 0) {
|
||||
group_update.joined = difference;
|
||||
}
|
||||
}
|
||||
else if (pushMessageContent.group.type === textsecure.protobuf.PushMessageContent.GroupContext.Type.QUIT) {
|
||||
var group_update = { left: source };
|
||||
attributes = { members: _.without(conversation.get('members'), source) };
|
||||
}
|
||||
|
||||
if (_.keys(group_update).length > 0) {
|
||||
message.set({group_update: group_update});
|
||||
}
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
className: "group-update",
|
||||
render: function() {
|
||||
//TODO l10n
|
||||
if (this.model.left) {
|
||||
this.$el.text(this.model.left + ' left the group');
|
||||
return this;
|
||||
}
|
||||
|
||||
var messages = ['Updated the group.'];
|
||||
if (this.model.name) {
|
||||
messages.push("Title is now '" + this.model.name + "'.");
|
||||
|
|
Loading…
Reference in a new issue