|
|
|
@ -1185,7 +1185,11 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|
|
|
|
[message saveIsCalculatingProofOfWork:YES withTransaction:transaction];
|
|
|
|
|
// Update the message and thread if needed
|
|
|
|
|
if (signalMessage.isFriendRequest) {
|
|
|
|
|
[message.thread saveFriendRequestStatus:LKThreadFriendRequestStatusRequestSending withTransaction:transaction];
|
|
|
|
|
__block TSContactThread *thread;
|
|
|
|
|
[OWSPrimaryStorage.sharedManager.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
|
|
|
|
thread = [TSContactThread getThreadWithContactId:recipientID transaction:transaction]; // Take into account multi device
|
|
|
|
|
}];
|
|
|
|
|
[thread saveFriendRequestStatus:LKThreadFriendRequestStatusRequestSending withTransaction:transaction];
|
|
|
|
|
[message saveFriendRequestStatus:LKMessageFriendRequestStatusSendingOrFailed withTransaction:transaction];
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
@ -1197,7 +1201,11 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|
|
|
|
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
|
|
|
|
// Update the message and thread if needed
|
|
|
|
|
if (signalMessage.isFriendRequest) {
|
|
|
|
|
[message.thread saveFriendRequestStatus:LKThreadFriendRequestStatusNone withTransaction:transaction];
|
|
|
|
|
__block TSContactThread *thread;
|
|
|
|
|
[OWSPrimaryStorage.sharedManager.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
|
|
|
|
thread = [TSContactThread getThreadWithContactId:recipientID transaction:transaction]; // Take into account multi device
|
|
|
|
|
}];
|
|
|
|
|
[thread saveFriendRequestStatus:LKThreadFriendRequestStatusNone withTransaction:transaction];
|
|
|
|
|
[message saveFriendRequestStatus:LKMessageFriendRequestStatusSendingOrFailed withTransaction:transaction];
|
|
|
|
|
}
|
|
|
|
|
// Update the PoW calculation status
|
|
|
|
@ -1224,7 +1232,11 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|
|
|
|
if (!message.skipSave) {
|
|
|
|
|
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
|
|
|
|
// Update the thread
|
|
|
|
|
[message.thread saveFriendRequestStatus:LKThreadFriendRequestStatusRequestSent withTransaction:transaction];
|
|
|
|
|
__block TSContactThread *thread;
|
|
|
|
|
[OWSPrimaryStorage.sharedManager.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
|
|
|
|
thread = [TSContactThread getThreadWithContactId:recipientID transaction:transaction]; // Take into account multi device
|
|
|
|
|
}];
|
|
|
|
|
[thread saveFriendRequestStatus:LKThreadFriendRequestStatusRequestSent withTransaction:transaction];
|
|
|
|
|
[message.thread removeOldOutgoingFriendRequestMessagesIfNeededWithTransaction:transaction];
|
|
|
|
|
if ([message.thread isKindOfClass:[TSContactThread class]]) {
|
|
|
|
|
[((TSContactThread *) message.thread) removeAllSessionRestoreDevicesWithTransaction:transaction];
|
|
|
|
|