Fix friend request acceptance bug
This commit is contained in:
parent
3c838c59b2
commit
2e8d62b3ee
|
@ -4301,6 +4301,9 @@ typedef enum : NSUInteger {
|
|||
|
||||
- (void)acceptFriendRequest:(TSIncomingMessage *)friendRequest
|
||||
{
|
||||
// Update the thread's friend request state
|
||||
[self.thread setFriendRequestStatus:TSThreadFriendRequestStatusFriends withTransaction:nil];
|
||||
// Send friend request accepted message
|
||||
[ThreadUtil enqueueAcceptFriendRequestMessageInThread:self.thread];
|
||||
}
|
||||
|
||||
|
|
|
@ -1485,8 +1485,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
// friend request status is reset to TSThreadFriendRequestStatusNone. Bob now sends Alice a friend
|
||||
// request. Alice's thread's friend request status is reset to
|
||||
// TSThreadFriendRequestStatusRequestReceived.
|
||||
message.isFriendRequest = YES; // It's important that this happens before the friend request status update below
|
||||
[thread setFriendRequestStatus:TSThreadFriendRequestStatusRequestReceived withTransaction:transaction];
|
||||
message.isFriendRequest = YES;
|
||||
}
|
||||
} else if (!thread.isContactFriend) {
|
||||
// If the thread's friend request status is not TSThreadFriendRequestStatusFriends, but we're receiving a message,
|
||||
|
|
|
@ -1119,10 +1119,6 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
// ========
|
||||
if (messageType == TSFriendRequestMessageType) {
|
||||
[message.thread setFriendRequestStatus:TSThreadFriendRequestStatusRequestSent withTransaction:nil];
|
||||
} else if (message.thread.hasCurrentUserReceivedFriendRequest) {
|
||||
// If the thread's current friend request state is TSThreadFriendRequestStatusRequestReceived, and we're sending a message,
|
||||
// that means we're accepting the request. Declining a friend request doesn't send a message.
|
||||
[message.thread setFriendRequestStatus:TSThreadFriendRequestStatusFriends withTransaction:nil];
|
||||
}
|
||||
// ========
|
||||
// Invoke the completion handler
|
||||
|
|
Loading…
Reference in New Issue