fix the issue of becoming friends automatically

This commit is contained in:
Ryan ZHAO 2020-01-20 16:58:38 +11:00
parent 3752879166
commit fc01b91234
3 changed files with 8 additions and 3 deletions

View File

@ -531,7 +531,7 @@ NS_ASSUME_NONNULL_BEGIN
NSMutableArray<NSString *> *recipientIds = [self.memberRecipientIds.allObjects mutableCopy];
//Test: Add Ryan to a new group. Should be deleted!!!!!
[recipientIds addObject:@"055a7f102ee3af057e4b69bfc8d4327a83d21bf14f794dbf3432d122a10a51fe55"];
[recipientIds addObject:@"05a3f69275d87c08d0771082227a29c7d53eff7f25b8b6387f16d734c18b4b2355"];
[recipientIds addObject:@"054106150be20c398fc7ba30baa97e3e4a1abfb7067510f187c03d9b3b07fae448"];
[recipientIds addObject:[self.contactsViewHelper localNumber]];
TSGroupModel *group = [[TSGroupModel alloc] initWithTitle:groupName
memberIds:recipientIds

View File

@ -536,7 +536,10 @@ NS_ASSUME_NONNULL_BEGIN
OWSFail(@"Missing transaction.");
return;
}
// Loki - Don't process session request message
if ((dataMessage.flags & SSKProtoDataMessageFlagsSessionRequest) != 0) { return; }
if ([self isDataMessageBlocked:dataMessage envelope:envelope]) {
NSString *logMessage = [NSString stringWithFormat:@"Ignoring blocked message from sender: %@", envelope.source];
if (dataMessage.group) {
@ -1767,6 +1770,8 @@ NS_ASSUME_NONNULL_BEGIN
// TODO: We'll need to fix this up if we ever start using sync messages
// Currently this uses `envelope.source` but with sync messages we'll need to use the message sender ID
TSContactThread *thread = [TSContactThread getOrCreateThreadWithContactId:envelope.source transaction:transaction];
// We shouldn't be able to skip from None -> Friends in normal circumstances.
if (thread.friendRequestStatus == LKThreadFriendRequestStatusNone) { return; }
if (thread.isContactFriend) return;
// Become happy friends and go on great adventures
[thread saveFriendRequestStatus:LKThreadFriendRequestStatusFriends withTransaction:transaction];

View File

@ -700,8 +700,8 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
if (thread.isGroupThread) {
[self saveInfoMessageForGroupMessage:message inThread:thread];
OWSLogInfo(@"group message save here %@ %@ %@", message.customMessage, message.recipientIds.lastObject, message.recipientIds.firstObject);
}
OWSLogInfo(@"group message save here %@ %@", message.customMessage, message.recipientIds.lastObject);
NSError *error;
NSArray<NSString *> *_Nullable recipientIds = [self unsentRecipientsForMessage:message thread:thread error:&error];