fix(manager)_: make sure to re-add revealed accounts in the response
We remove the shared accounts to send normal admins to not leak the addresses, however, that was a destructive action that also removed them from the `requestToJoin` param, which is reused later in the code, so it created an unwanted side effect. The side effect is now erased.
This commit is contained in:
parent
fc36a7e980
commit
8cafbcb3d2
|
@ -4897,8 +4897,8 @@ func (m *Manager) ShareRequestsToJoinWithPrivilegedMembers(community *Community,
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) shareAcceptedRequestToJoinWithPrivilegedMembers(community *Community, requestsToJoin *RequestToJoin) error {
|
func (m *Manager) shareAcceptedRequestToJoinWithPrivilegedMembers(community *Community, requestToJoin *RequestToJoin) error {
|
||||||
pk, err := common.HexToPubkey(requestsToJoin.PublicKey)
|
pk, err := common.HexToPubkey(requestToJoin.PublicKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -4906,9 +4906,13 @@ func (m *Manager) shareAcceptedRequestToJoinWithPrivilegedMembers(community *Com
|
||||||
acceptedRequestsToJoinWithoutRevealedAccounts := make(map[string]*protobuf.CommunityRequestToJoin)
|
acceptedRequestsToJoinWithoutRevealedAccounts := make(map[string]*protobuf.CommunityRequestToJoin)
|
||||||
acceptedRequestsToJoinWithRevealedAccounts := make(map[string]*protobuf.CommunityRequestToJoin)
|
acceptedRequestsToJoinWithRevealedAccounts := make(map[string]*protobuf.CommunityRequestToJoin)
|
||||||
|
|
||||||
acceptedRequestsToJoinWithRevealedAccounts[requestsToJoin.PublicKey] = requestsToJoin.ToCommunityRequestToJoinProtobuf()
|
acceptedRequestsToJoinWithRevealedAccounts[requestToJoin.PublicKey] = requestToJoin.ToCommunityRequestToJoinProtobuf()
|
||||||
requestsToJoin.RevealedAccounts = make([]*protobuf.RevealedAccount, 0)
|
|
||||||
acceptedRequestsToJoinWithoutRevealedAccounts[requestsToJoin.PublicKey] = requestsToJoin.ToCommunityRequestToJoinProtobuf()
|
revealedAccounts := requestToJoin.RevealedAccounts
|
||||||
|
requestToJoin.RevealedAccounts = make([]*protobuf.RevealedAccount, 0)
|
||||||
|
acceptedRequestsToJoinWithoutRevealedAccounts[requestToJoin.PublicKey] = requestToJoin.ToCommunityRequestToJoinProtobuf()
|
||||||
|
// Set back the revealed accounts
|
||||||
|
requestToJoin.RevealedAccounts = revealedAccounts
|
||||||
|
|
||||||
msgWithRevealedAccounts := &protobuf.CommunityPrivilegedUserSyncMessage{
|
msgWithRevealedAccounts := &protobuf.CommunityPrivilegedUserSyncMessage{
|
||||||
Type: protobuf.CommunityPrivilegedUserSyncMessage_CONTROL_NODE_ACCEPT_REQUEST_TO_JOIN,
|
Type: protobuf.CommunityPrivilegedUserSyncMessage_CONTROL_NODE_ACCEPT_REQUEST_TO_JOIN,
|
||||||
|
|
|
@ -922,6 +922,8 @@ func (s *MessengerCommunitiesSuite) TestRequestAccess() {
|
||||||
response, err = s.bob.AcceptRequestToJoinCommunity(acceptRequestToJoin)
|
response, err = s.bob.AcceptRequestToJoinCommunity(acceptRequestToJoin)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
|
s.Require().NotEmpty(response.RequestsToJoinCommunity())
|
||||||
|
s.Require().Len(response.RequestsToJoinCommunity()[0].RevealedAccounts, 1)
|
||||||
|
|
||||||
s.Require().Len(response.Communities(), 1)
|
s.Require().Len(response.Communities(), 1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue