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.
This commit is contained in:
lilia 2015-03-19 13:49:09 -07:00
parent 84237cae6f
commit 11b822eaf3
2 changed files with 10 additions and 2 deletions

View file

@ -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() {

View file

@ -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) {