-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(communities): enable selecting addresses to pass when joining #3656
Conversation
Pull Request Checklist
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I improved the utils functions in this test to accept passing multiple addresses. That enabled me to create the new test that verifies that when passing an address in the request, we indeed only receive that address in the owner's messenger.
Jenkins Builds
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me.
I've added some comments but they can be ignored
|
||
type RequestToJoinCommunity struct { | ||
CommunityID types.HexBytes `json:"communityId"` | ||
ENSName string `json:"ensName"` | ||
Password string `json:"password"` | ||
Addresses []string `json:"addresses"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you think about calling this AddressesToReveal
?
continue | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just another way to do it, but would be cool if we could change the check to something like
if wantsToRevealWalletAddress := addressToRevealMap[walletAccount.Address.Hex()]; hasAddressesToReveal && wantsToRevealWalletAddress {
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or for more readiness:
if len(request.Addresses) > 0 && !containsAddress(request.Addresses, walletAccount.Address.Hex()) {
continue
}
func containsAddress(addresses []string, targetAddress string) bool {
for _, address := range addresses {
if address == targetAddress {
return true
}
}
return false
}
Improve `RequestToJoinCommunity` to accept `Addresses` in the request. If `Addresses` is not empty, we then only pass to the owner the selected addresses. The others are ignored. Does not validate that the addresses in the slice are part of the user's wallet. Those not part of the wallet are just ignored.
1011b17
to
8ead8e6
Compare
Needed for status-im/status-desktop#11154
Improves
RequestToJoinCommunity
to acceptAddresses
in the request. IfAddresses
is not empty, we then only pass to the owner the selected addresses. The others are ignored. Does not validate that the addresses in the slice are part of the user's wallet. Those not part of the wallet are just ignored.