fix inconsistent contact request state (#3056)

This commit is contained in:
frank 2023-01-06 18:24:39 +08:00 committed by GitHub
parent ad67eb52e5
commit bea710c8be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -99,6 +99,7 @@ func makeMutualContact(origin *Messenger, contactPubkey *ecdsa.PublicKey) error
} }
contact.Added = true contact.Added = true
contact.HasAddedUs = true contact.HasAddedUs = true
contact.ContactRequestState = ContactRequestStateMutual
origin.allContacts.Store(contact.ID, contact) origin.allContacts.Store(contact.ID, contact)
return nil return nil

View File

@ -219,7 +219,7 @@ func (m *Messenger) checkIfCreatorIsOurContact(group *v1protocol.Group) bool {
creator, err := group.Creator() creator, err := group.Creator()
if err == nil { if err == nil {
contact, _ := m.allContacts.Load(creator) 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)) 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 return false