Fix undefined proto.source

This commit is contained in:
lilia 2014-12-22 13:24:02 -08:00
parent ccc98d2f3d
commit 30bca85f5a
2 changed files with 5 additions and 5 deletions

View file

@ -118,9 +118,9 @@
// This function can be called from the background script on an
// incoming message or from the frontend after the user accepts an
// identity key change.
return textsecure.processDecrypted(pushMessageContent).then(function(pushMessageContent) {
var source = message.get('source');
return textsecure.processDecrypted(pushMessageContent, source).then(function(pushMessageContent) {
var now = new Date().getTime();
var source = message.get('source');
var conversationId = pushMessageContent.group ? pushMessageContent.group.id : source;
var conversation = conversations.add({id: conversationId}, {merge: true});
conversation.fetch().always(function() {

View file

@ -147,7 +147,7 @@ var handleAttachment = function(attachment) {
then(updateAttachment);
};
textsecure.processDecrypted = function(decrypted) {
textsecure.processDecrypted = function(decrypted, source) {
// Now that its decrypted, validate the message and clean it up for consumer processing
// Note that messages may (generally) only perform one action and we ignore remaining fields
@ -174,7 +174,7 @@ textsecure.processDecrypted = function(decrypted) {
}
textsecure.storage.groups.createNewGroup(decrypted.group.members, decrypted.group.id);
} else {
var fromIndex = existingGroup.indexOf(proto.source);
var fromIndex = existingGroup.indexOf(source);
if (fromIndex < 0) {
//TODO: This could be indication of a race...
@ -209,7 +209,7 @@ textsecure.processDecrypted = function(decrypted) {
break;
case textsecure.protobuf.PushMessageContent.GroupContext.Type.QUIT:
textsecure.storage.groups.removeNumber(decrypted.group.id, proto.source);
textsecure.storage.groups.removeNumber(decrypted.group.id, source);
decrypted.body = null;
decrypted.attachments = [];