Adding checks for potentially undefined fields on config messages to prevent false negatives.

pull/2222/head
warrickct 3 years ago
parent 8ba0020a6c
commit e5ecb9c106

@ -140,7 +140,7 @@ const handleContactReceived = async (
contactConvo.set('active_at', _.toNumber(envelope.timestamp));
}
if (contactReceived.isApproved) {
if (contactReceived.isApproved) { // checking for existence of field on protobuf
await contactConvo.setIsApproved(Boolean(contactReceived.isApproved));
// TODO: add message search in convo for pre-existing msgRequestResponse msg only happens once per convo
await contactConvo.addSingleOutgoingMessage({
@ -152,10 +152,13 @@ const handleContactReceived = async (
expireTimer: 0,
});
contactConvo.updateLastMessage();
await contactConvo.setDidApproveMe(Boolean(contactReceived.didApproveMe));
if (contactReceived.didApproveMe) { // checking for existence of field on message
await contactConvo.setDidApproveMe(Boolean(contactReceived.didApproveMe));
}
}
if (contactReceived.isBlocked) {
if (contactReceived.isBlocked) { // checking for existence of field on protobuf
await BlockedNumberController.block(contactConvo.id);
} else {
await BlockedNumberController.unblock(contactConvo.id);

Loading…
Cancel
Save