Respond to CR.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-09-21 17:25:13 -04:00
parent d40862fd70
commit 77e0c9664c
4 changed files with 16 additions and 10 deletions

View File

@ -43,6 +43,8 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(TSThread *)thread
{
OWSAssert(timestamp > 0);
self = [super initWithUniqueId:nil];
if (!self) {

View File

@ -266,14 +266,14 @@ NS_ASSUME_NONNULL_BEGIN
TSIncomingMessage *incomingMessage = (TSIncomingMessage *)message;
NSString *contactName = [contactsManager displayNameForPhoneIdentifier:incomingMessage.messageAuthorId];
// We want the info message to appear after the message.
[[[OWSDisappearingConfigurationUpdateInfoMessage alloc] initWithTimestamp:message.timestamp + 1
// We want the info message to appear _before_ the message.
[[[OWSDisappearingConfigurationUpdateInfoMessage alloc] initWithTimestamp:message.timestamp - 1
thread:message.thread
configuration:disappearingMessagesConfiguration
createdByRemoteName:contactName] save];
} else {
// We want the info message to appear after the message.
[[[OWSDisappearingConfigurationUpdateInfoMessage alloc] initWithTimestamp:message.timestamp + 1
// We want the info message to appear _before_ the message.
[[[OWSDisappearingConfigurationUpdateInfoMessage alloc] initWithTimestamp:message.timestamp - 1
thread:message.thread
configuration:disappearingMessagesConfiguration]
save];

View File

@ -193,7 +193,7 @@ NS_ASSUME_NONNULL_BEGIN
} else {
// Desktop currently sends delivery receipts for "unpersisted" messages
// like group updates, so these errors are expected to a certain extent.
DDLogError(@"%@ Unexpected message with timestamp: %llu", self.tag, envelope.timestamp);
DDLogInfo(@"%@ Unexpected message with timestamp: %llu", self.tag, envelope.timestamp);
}
}

View File

@ -434,7 +434,13 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
//
// That's key - we don't want to send any messages in response
// to an incoming message until processing of that batch of messages
// is complete.
// is complete. For example, we wouldn't want to auto-reply to a
// group info request before that group info request's batch was
// finished processing. Otherwise, we might receive a delivery
// notice for a group update we hadn't yet saved to the db.
//
// So we're using YDB behavior to ensure this invariant, which is a bit
// unorthodox.
[message updateWithMessageState:TSOutgoingMessageStateAttemptingOut];
OWSSendMessageOperation *sendMessageOperation =
@ -1328,14 +1334,12 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
// TODO: Why is this necessary?
[message save];
} else if (message.groupMetaMessage == TSGroupMessageQuit) {
// We want the info message to appear after the message.
[[[TSInfoMessage alloc] initWithTimestamp:message.timestamp + 1
[[[TSInfoMessage alloc] initWithTimestamp:message.timestamp
inThread:thread
messageType:TSInfoMessageTypeGroupQuit
customMessage:message.customMessage] save];
} else {
// We want the info message to appear after the message.
[[[TSInfoMessage alloc] initWithTimestamp:message.timestamp + 1
[[[TSInfoMessage alloc] initWithTimestamp:message.timestamp
inThread:thread
messageType:TSInfoMessageTypeGroupUpdate
customMessage:message.customMessage] save];