Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent fd9ee4c9f3
commit c5f52cc0b9

@ -71,6 +71,7 @@ NS_ASSUME_NONNULL_BEGIN
TSOutgoingMessageRecipientState *_Nullable recipientState =
[self.message recipientStateForRecipientId:recipientId];
if (!recipientState) {
OWSFailDebug(@"missing recipient state for: %@", recipientId);
continue;
}
if (recipientState.state != OWSOutgoingMessageRecipientStateSent) {

@ -739,6 +739,11 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
NSMutableDictionary<NSString *, TSOutgoingMessageRecipientState *> *recipientStateMap
= [NSMutableDictionary new];
for (NSString *recipientId in udRecipientIds) {
if (recipientStateMap[recipientId]) {
OWSFailDebug(
@"recipient appears more than once in recipient lists: %@", recipientId);
continue;
}
TSOutgoingMessageRecipientState *recipientState =
[TSOutgoingMessageRecipientState new];
recipientState.state = OWSOutgoingMessageRecipientStateSent;
@ -746,6 +751,11 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
recipientStateMap[recipientId] = recipientState;
}
for (NSString *recipientId in nonUdRecipientIds) {
if (recipientStateMap[recipientId]) {
OWSFailDebug(
@"recipient appears more than once in recipient lists: %@", recipientId);
continue;
}
TSOutgoingMessageRecipientState *recipientState =
[TSOutgoingMessageRecipientState new];
recipientState.state = OWSOutgoingMessageRecipientStateSent;
@ -754,7 +764,9 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
}
[message setRecipientStateMap:recipientStateMap];
} else {
// Otherwise, mark any "sending" recipients as "sent."
// Otherwise assume this is a legacy message before UD was introduced, and mark
// any "sending" recipient as "sent". Note that this will apply to non-legacy
// messages with no recipients.
for (TSOutgoingMessageRecipientState *recipientState in message.recipientStateMap
.allValues) {
if (recipientState.state == OWSOutgoingMessageRecipientStateSending) {

Loading…
Cancel
Save