Fix fetching revealed accounts in `GetCommunityMembersForWalletAddresses` (#3891)
https://github.com/status-im/status-desktop/issues/11143
This commit is contained in:
parent
1a05c84585
commit
6d3e6d1b5d
|
@ -4506,15 +4506,22 @@ func (m *Messenger) GetCommunityMembersForWalletAddresses(communityID types.HexB
|
|||
|
||||
membersForAddresses := map[string]*Contact{}
|
||||
|
||||
for memberID, member := range community.Members() {
|
||||
for _, revealedAddress := range member.RevealedAccounts {
|
||||
if slices.Contains(revealedAddress.ChainIds, chainID) {
|
||||
contact, ok := m.allContacts.Load(memberID)
|
||||
if ok {
|
||||
membersForAddresses[revealedAddress.Address] = contact
|
||||
} else {
|
||||
m.logger.Error("community member is not a contact", zap.String("contact ID", memberID))
|
||||
for _, memberPubKey := range community.GetMemberPubkeys() {
|
||||
memberPubKeyStr := common.PubkeyToHex(memberPubKey)
|
||||
revealedAccounts, err := m.communitiesManager.GetRevealedAddresses(communityID, memberPubKeyStr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, revealedAccount := range revealedAccounts {
|
||||
if !slices.Contains(revealedAccount.ChainIds, chainID) {
|
||||
continue
|
||||
}
|
||||
|
||||
contact, ok := m.allContacts.Load(memberPubKeyStr)
|
||||
if ok {
|
||||
membersForAddresses[revealedAccount.Address] = contact
|
||||
} else {
|
||||
m.logger.Error("community member is not a contact", zap.String("contact ID", memberPubKeyStr))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue