Allow unknown groups

Save groups even if we've never heard of them. Previously
we would fail to save due to a missing 'type' attribute.
pull/749/head
lilia 10 years ago
parent 84237cae6f
commit 11b822eaf3

@ -180,7 +180,11 @@
},
getTitle: function() {
return this.get('name') || this.get('members') || this.id;
if (this.isPrivate()) {
return this.get('name') || this.id;
} else {
return this.get('name') || 'Unknown group';
}
},
getNumber: function() {

@ -122,6 +122,10 @@
conversation.fetch().always(function() {
if (pushMessageContent.group) {
var group_update = {};
attributes = {
type: 'group',
groupId: pushMessageContent.group.id,
};
if (pushMessageContent.group.type === textsecure.protobuf.PushMessageContent.GroupContext.Type.UPDATE) {
attributes = {
type : 'group',
@ -138,7 +142,7 @@
}
else if (pushMessageContent.group.type === textsecure.protobuf.PushMessageContent.GroupContext.Type.QUIT) {
group_update = { left: source };
attributes = { members: _.without(conversation.get('members'), source) };
attributes.members = _.without(conversation.get('members'), source);
}
if (_.keys(group_update).length > 0) {

Loading…
Cancel
Save