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{}
|
membersForAddresses := map[string]*Contact{}
|
||||||
|
|
||||||
for memberID, member := range community.Members() {
|
for _, memberPubKey := range community.GetMemberPubkeys() {
|
||||||
for _, revealedAddress := range member.RevealedAccounts {
|
memberPubKeyStr := common.PubkeyToHex(memberPubKey)
|
||||||
if slices.Contains(revealedAddress.ChainIds, chainID) {
|
revealedAccounts, err := m.communitiesManager.GetRevealedAddresses(communityID, memberPubKeyStr)
|
||||||
contact, ok := m.allContacts.Load(memberID)
|
if err != nil {
|
||||||
if ok {
|
return nil, err
|
||||||
membersForAddresses[revealedAddress.Address] = contact
|
}
|
||||||
} else {
|
for _, revealedAccount := range revealedAccounts {
|
||||||
m.logger.Error("community member is not a contact", zap.String("contact ID", memberID))
|
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