From bea710c8be901d46312940ab3398eb67397058d3 Mon Sep 17 00:00:00 2001 From: frank Date: Fri, 6 Jan 2023 18:24:39 +0800 Subject: [PATCH] fix inconsistent contact request state (#3056) --- protocol/messenger_group_chat_test.go | 1 + protocol/messenger_handler.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/protocol/messenger_group_chat_test.go b/protocol/messenger_group_chat_test.go index 2f80fcf59..a22402517 100644 --- a/protocol/messenger_group_chat_test.go +++ b/protocol/messenger_group_chat_test.go @@ -99,6 +99,7 @@ func makeMutualContact(origin *Messenger, contactPubkey *ecdsa.PublicKey) error } contact.Added = true contact.HasAddedUs = true + contact.ContactRequestState = ContactRequestStateMutual origin.allContacts.Store(contact.ID, contact) return nil diff --git a/protocol/messenger_handler.go b/protocol/messenger_handler.go index 6e860cc9e..18de4cb22 100644 --- a/protocol/messenger_handler.go +++ b/protocol/messenger_handler.go @@ -219,7 +219,7 @@ func (m *Messenger) checkIfCreatorIsOurContact(group *v1protocol.Group) bool { creator, err := group.Creator() if err == nil { contact, _ := m.allContacts.Load(creator) - return contact != nil && contact.Added && contact.HasAddedUs + return contact != nil && contact.ContactRequestState == ContactRequestStateMutual } m.logger.Warn("failed to get creator from group", zap.String("group name", group.Name()), zap.String("group chat id", group.ChatID()), zap.Error(err)) return false