[Fixes: #4687] Change requestsToJoinCommunity to a map
The test was flaky because of re-receiving the message, which resulted in multiple identical requestsToJoin being added to messengerResponse. We should in general avoid using arrays in messengerResponse and prefer maps for exactly this reason.
This commit is contained in:
parent
c15f9e7365
commit
c49a0fc314
|
@ -1060,15 +1060,15 @@ func testAcceptMemberRequestToJoin(base CommunityEventsTestsInterface, community
|
||||||
response, err := user.RequestToJoinCommunity(requestToJoin)
|
response, err := user.RequestToJoinCommunity(requestToJoin)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
sentRequest := response.RequestsToJoinCommunity[0]
|
sentRequest := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
checkRequestToJoin := func(r *MessengerResponse) bool {
|
checkRequestToJoin := func(r *MessengerResponse) bool {
|
||||||
if len(r.RequestsToJoinCommunity) == 0 {
|
if len(r.RequestsToJoinCommunity()) == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
for _, request := range r.RequestsToJoinCommunity {
|
for _, request := range r.RequestsToJoinCommunity() {
|
||||||
if request.ENSName == requestToJoin.ENSName {
|
if request.ENSName == requestToJoin.ENSName {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -1082,7 +1082,7 @@ func testAcceptMemberRequestToJoin(base CommunityEventsTestsInterface, community
|
||||||
"event sender did not receive community request to join",
|
"event sender did not receive community request to join",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// control node receives request to join
|
// control node receives request to join
|
||||||
_, err = WaitOnMessengerResponse(
|
_, err = WaitOnMessengerResponse(
|
||||||
|
@ -1176,14 +1176,14 @@ func testAcceptMemberRequestToJoinResponseSharedWithOtherEventSenders(base Commu
|
||||||
response, err := user.RequestToJoinCommunity(requestToJoin)
|
response, err := user.RequestToJoinCommunity(requestToJoin)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
sentRequest := response.RequestsToJoinCommunity[0]
|
sentRequest := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
// event sender receives request to join
|
// event sender receives request to join
|
||||||
_, err = WaitOnMessengerResponse(
|
_, err = WaitOnMessengerResponse(
|
||||||
base.GetEventSender(),
|
base.GetEventSender(),
|
||||||
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity) > 0 },
|
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity()) > 0 },
|
||||||
"event sender did not receive community request to join",
|
"event sender did not receive community request to join",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
@ -1191,7 +1191,7 @@ func testAcceptMemberRequestToJoinResponseSharedWithOtherEventSenders(base Commu
|
||||||
// event sender 2 receives request to join
|
// event sender 2 receives request to join
|
||||||
_, err = WaitOnMessengerResponse(
|
_, err = WaitOnMessengerResponse(
|
||||||
additionalEventSender,
|
additionalEventSender,
|
||||||
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity) > 0 },
|
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity()) > 0 },
|
||||||
"event sender did not receive community request to join",
|
"event sender did not receive community request to join",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
@ -1248,27 +1248,27 @@ func testRejectMemberRequestToJoinResponseSharedWithOtherEventSenders(base Commu
|
||||||
response, err := user.RequestToJoinCommunity(requestToJoin)
|
response, err := user.RequestToJoinCommunity(requestToJoin)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
sentRequest := response.RequestsToJoinCommunity[0]
|
sentRequest := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
// event sender receives request to join
|
// event sender receives request to join
|
||||||
response, err = WaitOnMessengerResponse(
|
response, err = WaitOnMessengerResponse(
|
||||||
base.GetEventSender(),
|
base.GetEventSender(),
|
||||||
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity) > 0 },
|
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity()) > 0 },
|
||||||
"event sender did not receive community request to join",
|
"event sender did not receive community request to join",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// event sender 2 receives request to join
|
// event sender 2 receives request to join
|
||||||
response, err = WaitOnMessengerResponse(
|
response, err = WaitOnMessengerResponse(
|
||||||
additionalEventSender,
|
additionalEventSender,
|
||||||
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity) > 0 },
|
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity()) > 0 },
|
||||||
"event sender did not receive community request to join",
|
"event sender did not receive community request to join",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
rejectRequestToJoin := &requests.DeclineRequestToJoinCommunity{ID: sentRequest.ID}
|
rejectRequestToJoin := &requests.DeclineRequestToJoinCommunity{ID: sentRequest.ID}
|
||||||
response, err = base.GetEventSender().DeclineRequestToJoinCommunity(rejectRequestToJoin)
|
response, err = base.GetEventSender().DeclineRequestToJoinCommunity(rejectRequestToJoin)
|
||||||
|
@ -1321,27 +1321,27 @@ func testRejectMemberRequestToJoin(base CommunityEventsTestsInterface, community
|
||||||
response, err := user.RequestToJoinCommunity(requestToJoin)
|
response, err := user.RequestToJoinCommunity(requestToJoin)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
sentRequest := response.RequestsToJoinCommunity[0]
|
sentRequest := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
// event sender receives request to join
|
// event sender receives request to join
|
||||||
response, err = WaitOnMessengerResponse(
|
response, err = WaitOnMessengerResponse(
|
||||||
base.GetEventSender(),
|
base.GetEventSender(),
|
||||||
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity) > 0 },
|
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity()) > 0 },
|
||||||
"event sender did not receive community request to join",
|
"event sender did not receive community request to join",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// control node receives request to join
|
// control node receives request to join
|
||||||
response, err = WaitOnMessengerResponse(
|
response, err = WaitOnMessengerResponse(
|
||||||
base.GetControlNode(),
|
base.GetControlNode(),
|
||||||
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity) > 0 },
|
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity()) > 0 },
|
||||||
"control node did not receive community request to join",
|
"control node did not receive community request to join",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// event sender has not accepted request yet
|
// event sender has not accepted request yet
|
||||||
eventSenderCommunity, err := base.GetEventSender().GetCommunityByID(community.ID())
|
eventSenderCommunity, err := base.GetEventSender().GetCommunityByID(community.ID())
|
||||||
|
@ -1420,14 +1420,14 @@ func testControlNodeHandlesMultipleEventSenderRequestToJoinDecisions(base Commun
|
||||||
response, err := user.RequestToJoinCommunity(requestToJoin)
|
response, err := user.RequestToJoinCommunity(requestToJoin)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
sentRequest := response.RequestsToJoinCommunity[0]
|
sentRequest := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
// event sender receives request to join
|
// event sender receives request to join
|
||||||
_, err = WaitOnMessengerResponse(
|
_, err = WaitOnMessengerResponse(
|
||||||
base.GetEventSender(),
|
base.GetEventSender(),
|
||||||
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity) > 0 },
|
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity()) > 0 },
|
||||||
"event sender did not receive community request to join",
|
"event sender did not receive community request to join",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
@ -1435,7 +1435,7 @@ func testControlNodeHandlesMultipleEventSenderRequestToJoinDecisions(base Commun
|
||||||
// event sender 2 receives request to join
|
// event sender 2 receives request to join
|
||||||
_, err = WaitOnMessengerResponse(
|
_, err = WaitOnMessengerResponse(
|
||||||
additionalEventSender,
|
additionalEventSender,
|
||||||
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity) > 0 },
|
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity()) > 0 },
|
||||||
"event sender did not receive community request to join",
|
"event sender did not receive community request to join",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
@ -1443,7 +1443,7 @@ func testControlNodeHandlesMultipleEventSenderRequestToJoinDecisions(base Commun
|
||||||
// control node receives request to join
|
// control node receives request to join
|
||||||
_, err = WaitOnMessengerResponse(
|
_, err = WaitOnMessengerResponse(
|
||||||
base.GetControlNode(),
|
base.GetControlNode(),
|
||||||
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity) > 0 },
|
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity()) > 0 },
|
||||||
"event sender did not receive community request to join",
|
"event sender did not receive community request to join",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
@ -1461,7 +1461,7 @@ func testControlNodeHandlesMultipleEventSenderRequestToJoinDecisions(base Commun
|
||||||
// control node receives event sender 1's and 2's decision
|
// control node receives event sender 1's and 2's decision
|
||||||
_, err = WaitOnMessengerResponse(
|
_, err = WaitOnMessengerResponse(
|
||||||
base.GetControlNode(),
|
base.GetControlNode(),
|
||||||
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity) > 0 },
|
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity()) > 0 },
|
||||||
"control node did not receive event senders decision",
|
"control node did not receive event senders decision",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
@ -2231,15 +2231,15 @@ func testPrivilegedMemberAcceptsRequestToJoinAfterMemberLeave(base CommunityEven
|
||||||
response, err := user.RequestToJoinCommunity(requestToJoin)
|
response, err := user.RequestToJoinCommunity(requestToJoin)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
sentRequest := response.RequestsToJoinCommunity[0]
|
sentRequest := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
checkRequestToJoin := func(r *MessengerResponse) bool {
|
checkRequestToJoin := func(r *MessengerResponse) bool {
|
||||||
if len(r.RequestsToJoinCommunity) == 0 {
|
if len(r.RequestsToJoinCommunity()) == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
for _, request := range r.RequestsToJoinCommunity {
|
for _, request := range r.RequestsToJoinCommunity() {
|
||||||
if request.ENSName == requestToJoin.ENSName {
|
if request.ENSName == requestToJoin.ENSName {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -2253,7 +2253,7 @@ func testPrivilegedMemberAcceptsRequestToJoinAfterMemberLeave(base CommunityEven
|
||||||
"event sender did not receive community request to join",
|
"event sender did not receive community request to join",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// control node receives request to join
|
// control node receives request to join
|
||||||
_, err = WaitOnMessengerResponse(
|
_, err = WaitOnMessengerResponse(
|
||||||
|
@ -2361,7 +2361,7 @@ func testPrivilegedMemberAcceptsRequestToJoinAfterMemberLeave(base CommunityEven
|
||||||
response, err = user.RequestToJoinCommunity(requestToJoin)
|
response, err = user.RequestToJoinCommunity(requestToJoin)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// event sender receives request to join
|
// event sender receives request to join
|
||||||
response, err = WaitOnMessengerResponse(
|
response, err = WaitOnMessengerResponse(
|
||||||
|
@ -2370,7 +2370,7 @@ func testPrivilegedMemberAcceptsRequestToJoinAfterMemberLeave(base CommunityEven
|
||||||
"event sender did not receive community request to join",
|
"event sender did not receive community request to join",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// control node receives request to join
|
// control node receives request to join
|
||||||
_, err = WaitOnMessengerResponse(
|
_, err = WaitOnMessengerResponse(
|
||||||
|
|
|
@ -400,7 +400,7 @@ func joinCommunity(s *suite.Suite, community *communities.Community, owner *Mess
|
||||||
response, err := user.RequestToJoinCommunity(request)
|
response, err := user.RequestToJoinCommunity(request)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
||||||
|
|
||||||
notification := response.ActivityCenterNotifications()[0]
|
notification := response.ActivityCenterNotifications()[0]
|
||||||
|
@ -425,19 +425,19 @@ func requestToJoinCommunity(s *suite.Suite, controlNode *Messenger, user *Messen
|
||||||
response, err := user.RequestToJoinCommunity(request)
|
response, err := user.RequestToJoinCommunity(request)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin := response.RequestsToJoinCommunity[0]
|
requestToJoin := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().Equal(requestToJoin.PublicKey, common.PubkeyToHex(&user.identity.PublicKey))
|
s.Require().Equal(requestToJoin.PublicKey, common.PubkeyToHex(&user.identity.PublicKey))
|
||||||
|
|
||||||
_, err = WaitOnMessengerResponse(
|
_, err = WaitOnMessengerResponse(
|
||||||
controlNode,
|
controlNode,
|
||||||
func(r *MessengerResponse) bool {
|
func(r *MessengerResponse) bool {
|
||||||
if len(r.RequestsToJoinCommunity) == 0 {
|
if len(r.RequestsToJoinCommunity()) == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, resultRequest := range r.RequestsToJoinCommunity {
|
for _, resultRequest := range r.RequestsToJoinCommunity() {
|
||||||
if resultRequest.PublicKey == common.PubkeyToHex(&user.identity.PublicKey) {
|
if resultRequest.PublicKey == common.PubkeyToHex(&user.identity.PublicKey) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,9 +235,9 @@ func (s *MessengerCommunitiesSuite) TestJoiningOpenCommunityReturnsChatsResponse
|
||||||
response, err = s.alice.RequestToJoinCommunity(request)
|
response, err = s.alice.RequestToJoinCommunity(request)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin := response.RequestsToJoinCommunity[0]
|
requestToJoin := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().NotNil(requestToJoin)
|
s.Require().NotNil(requestToJoin)
|
||||||
s.Require().Equal(community.ID(), requestToJoin.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin.CommunityID)
|
||||||
s.Require().NotEmpty(requestToJoin.ID)
|
s.Require().NotEmpty(requestToJoin.ID)
|
||||||
|
@ -250,7 +250,7 @@ func (s *MessengerCommunitiesSuite) TestJoiningOpenCommunityReturnsChatsResponse
|
||||||
response, err = WaitOnMessengerResponse(
|
response, err = WaitOnMessengerResponse(
|
||||||
s.bob,
|
s.bob,
|
||||||
func(r *MessengerResponse) bool {
|
func(r *MessengerResponse) bool {
|
||||||
return len(r.Communities()) > 0 && len(r.RequestsToJoinCommunity) > 0
|
return len(r.Communities()) > 0 && len(r.RequestsToJoinCommunity()) > 0
|
||||||
},
|
},
|
||||||
"message not received",
|
"message not received",
|
||||||
)
|
)
|
||||||
|
@ -829,7 +829,7 @@ func (s *MessengerCommunitiesSuite) TestRequestAccess() {
|
||||||
response, err = s.alice.RequestToJoinCommunity(request)
|
response, err = s.alice.RequestToJoinCommunity(request)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
||||||
|
|
||||||
|
@ -841,7 +841,7 @@ func (s *MessengerCommunitiesSuite) TestRequestAccess() {
|
||||||
s.Require().Equal(notification.Accepted, false)
|
s.Require().Equal(notification.Accepted, false)
|
||||||
s.Require().Equal(notification.Dismissed, false)
|
s.Require().Equal(notification.Dismissed, false)
|
||||||
|
|
||||||
requestToJoin1 := response.RequestsToJoinCommunity[0]
|
requestToJoin1 := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().NotNil(requestToJoin1)
|
s.Require().NotNil(requestToJoin1)
|
||||||
s.Require().Equal(community.ID(), requestToJoin1.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin1.CommunityID)
|
||||||
s.Require().True(requestToJoin1.Our)
|
s.Require().True(requestToJoin1.Our)
|
||||||
|
@ -884,15 +884,15 @@ func (s *MessengerCommunitiesSuite) TestRequestAccess() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if len(response.RequestsToJoinCommunity) == 0 {
|
if len(response.RequestsToJoinCommunity()) == 0 {
|
||||||
return errors.New("request to join community not received")
|
return errors.New("request to join community not received")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin2 := response.RequestsToJoinCommunity[0]
|
requestToJoin2 := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
s.Require().NotNil(requestToJoin2)
|
s.Require().NotNil(requestToJoin2)
|
||||||
s.Require().Equal(community.ID(), requestToJoin2.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin2.CommunityID)
|
||||||
|
@ -954,8 +954,8 @@ func (s *MessengerCommunitiesSuite) TestRequestAccess() {
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
|
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
s.Require().Equal(communities.RequestToJoinStateAccepted, response.RequestsToJoinCommunity[0].State)
|
s.Require().Equal(communities.RequestToJoinStateAccepted, response.RequestsToJoinCommunity()[0].State)
|
||||||
|
|
||||||
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
||||||
|
|
||||||
|
@ -1036,9 +1036,9 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccess() {
|
||||||
response, err = s.alice.RequestToJoinCommunity(request)
|
response, err = s.alice.RequestToJoinCommunity(request)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin := response.RequestsToJoinCommunity[0]
|
requestToJoin := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().NotNil(requestToJoin)
|
s.Require().NotNil(requestToJoin)
|
||||||
s.Require().Equal(community.ID(), requestToJoin.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin.CommunityID)
|
||||||
s.Require().NotEmpty(requestToJoin.ID)
|
s.Require().NotEmpty(requestToJoin.ID)
|
||||||
|
@ -1077,12 +1077,12 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccess() {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(response.RequestsToJoinCommunity) == 0 {
|
if len(response.RequestsToJoinCommunity()) == 0 {
|
||||||
return errors.New("request to join community not received")
|
return errors.New("request to join community not received")
|
||||||
}
|
}
|
||||||
|
|
||||||
// updating request clock by 8 days back
|
// updating request clock by 8 days back
|
||||||
requestToJoin := response.RequestsToJoinCommunity[0]
|
requestToJoin := response.RequestsToJoinCommunity()[0]
|
||||||
err = s.bob.communitiesManager.UpdateClockInRequestToJoin(requestToJoin.ID, requestTime)
|
err = s.bob.communitiesManager.UpdateClockInRequestToJoin(requestToJoin.ID, requestTime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -1094,7 +1094,7 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccess() {
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// Check activity center notification for Bob
|
// Check activity center notification for Bob
|
||||||
fetchActivityCenterNotificationsForAdmin := func() (*ActivityCenterPaginationResponse, error) {
|
fetchActivityCenterNotificationsForAdmin := func() (*ActivityCenterPaginationResponse, error) {
|
||||||
|
@ -1116,10 +1116,10 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccess() {
|
||||||
// Delete pending request to join
|
// Delete pending request to join
|
||||||
response, err = s.alice.CheckAndDeletePendingRequestToJoinCommunity(ctx, true)
|
response, err = s.alice.CheckAndDeletePendingRequestToJoinCommunity(ctx, true)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
||||||
|
|
||||||
requestToJoin = response.RequestsToJoinCommunity[0]
|
requestToJoin = response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().True(requestToJoin.Deleted)
|
s.Require().True(requestToJoin.Deleted)
|
||||||
|
|
||||||
notification = response.ActivityCenterNotifications()[0]
|
notification = response.ActivityCenterNotifications()[0]
|
||||||
|
@ -1128,10 +1128,10 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccess() {
|
||||||
|
|
||||||
response, err = s.bob.CheckAndDeletePendingRequestToJoinCommunity(ctx, true)
|
response, err = s.bob.CheckAndDeletePendingRequestToJoinCommunity(ctx, true)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
||||||
|
|
||||||
requestToJoin = response.RequestsToJoinCommunity[0]
|
requestToJoin = response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().True(requestToJoin.Deleted)
|
s.Require().True(requestToJoin.Deleted)
|
||||||
|
|
||||||
notification = response.ActivityCenterNotifications()[0]
|
notification = response.ActivityCenterNotifications()[0]
|
||||||
|
@ -1143,9 +1143,9 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccess() {
|
||||||
response, err = s.alice.RequestToJoinCommunity(request)
|
response, err = s.alice.RequestToJoinCommunity(request)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
aliceRequestToJoin := response.RequestsToJoinCommunity[0]
|
aliceRequestToJoin := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
// Retrieve request to join and Check activity center notification for Bob
|
// Retrieve request to join and Check activity center notification for Bob
|
||||||
err = tt.RetryWithBackOff(func() error {
|
err = tt.RetryWithBackOff(func() error {
|
||||||
|
@ -1157,7 +1157,7 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccess() {
|
||||||
// because request to join are hard deleted from the database, we can't check
|
// because request to join are hard deleted from the database, we can't check
|
||||||
// whether that's an old one or a new one. So here we test for the specific id
|
// whether that's an old one or a new one. So here we test for the specific id
|
||||||
|
|
||||||
for _, r := range response.RequestsToJoinCommunity {
|
for _, r := range response.RequestsToJoinCommunity() {
|
||||||
if bytes.Equal(r.ID, aliceRequestToJoin.ID) {
|
if bytes.Equal(r.ID, aliceRequestToJoin.ID) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1228,7 +1228,7 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccessWithDeclinedSt
|
||||||
response, err = s.alice.RequestToJoinCommunity(request)
|
response, err = s.alice.RequestToJoinCommunity(request)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
notification := response.ActivityCenterNotifications()[0]
|
notification := response.ActivityCenterNotifications()[0]
|
||||||
s.Require().NotNil(notification)
|
s.Require().NotNil(notification)
|
||||||
|
@ -1238,7 +1238,7 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccessWithDeclinedSt
|
||||||
s.Require().Equal(notification.Deleted, false)
|
s.Require().Equal(notification.Deleted, false)
|
||||||
s.Require().Equal(notification.Read, true)
|
s.Require().Equal(notification.Read, true)
|
||||||
|
|
||||||
requestToJoin := response.RequestsToJoinCommunity[0]
|
requestToJoin := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().NotNil(requestToJoin)
|
s.Require().NotNil(requestToJoin)
|
||||||
s.Require().Equal(community.ID(), requestToJoin.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin.CommunityID)
|
||||||
s.Require().NotEmpty(requestToJoin.ID)
|
s.Require().NotEmpty(requestToJoin.ID)
|
||||||
|
@ -1293,12 +1293,12 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccessWithDeclinedSt
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(response.RequestsToJoinCommunity) == 0 {
|
if len(response.RequestsToJoinCommunity()) == 0 {
|
||||||
return errors.New("request to join community not received")
|
return errors.New("request to join community not received")
|
||||||
}
|
}
|
||||||
|
|
||||||
// updating request clock by 8 days back
|
// updating request clock by 8 days back
|
||||||
requestToJoin := response.RequestsToJoinCommunity[0]
|
requestToJoin := response.RequestsToJoinCommunity()[0]
|
||||||
err = s.bob.communitiesManager.UpdateClockInRequestToJoin(requestToJoin.ID, requestTime)
|
err = s.bob.communitiesManager.UpdateClockInRequestToJoin(requestToJoin.ID, requestTime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -1310,7 +1310,7 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccessWithDeclinedSt
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// Check activity center notification for Bob
|
// Check activity center notification for Bob
|
||||||
fetchActivityCenterNotificationsForAdmin := func() (*ActivityCenterPaginationResponse, error) {
|
fetchActivityCenterNotificationsForAdmin := func() (*ActivityCenterPaginationResponse, error) {
|
||||||
|
@ -1376,9 +1376,9 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccessWithDeclinedSt
|
||||||
// Delete pending request to join
|
// Delete pending request to join
|
||||||
response, err = s.alice.CheckAndDeletePendingRequestToJoinCommunity(ctx, true)
|
response, err = s.alice.CheckAndDeletePendingRequestToJoinCommunity(ctx, true)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin = response.RequestsToJoinCommunity[0]
|
requestToJoin = response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().True(requestToJoin.Deleted)
|
s.Require().True(requestToJoin.Deleted)
|
||||||
|
|
||||||
notification = response.ActivityCenterNotifications()[0]
|
notification = response.ActivityCenterNotifications()[0]
|
||||||
|
@ -1396,7 +1396,7 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccessWithDeclinedSt
|
||||||
response, err = s.alice.RequestToJoinCommunity(request)
|
response, err = s.alice.RequestToJoinCommunity(request)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// Retrieve request to join and Check activity center notification for Bob
|
// Retrieve request to join and Check activity center notification for Bob
|
||||||
err = tt.RetryWithBackOff(func() error {
|
err = tt.RetryWithBackOff(func() error {
|
||||||
|
@ -1405,7 +1405,7 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccessWithDeclinedSt
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(response.RequestsToJoinCommunity) == 0 {
|
if len(response.RequestsToJoinCommunity()) == 0 {
|
||||||
return errors.New("request to join community not received")
|
return errors.New("request to join community not received")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1416,7 +1416,7 @@ func (s *MessengerCommunitiesSuite) TestDeletePendingRequestAccessWithDeclinedSt
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// Check activity center notification for Bob
|
// Check activity center notification for Bob
|
||||||
notifications, err = fetchActivityCenterNotificationsForAdmin()
|
notifications, err = fetchActivityCenterNotificationsForAdmin()
|
||||||
|
@ -1482,9 +1482,9 @@ func (s *MessengerCommunitiesSuite) TestCancelRequestAccess() {
|
||||||
response, err = s.alice.RequestToJoinCommunity(request)
|
response, err = s.alice.RequestToJoinCommunity(request)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin1 := response.RequestsToJoinCommunity[0]
|
requestToJoin1 := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().NotNil(requestToJoin1)
|
s.Require().NotNil(requestToJoin1)
|
||||||
s.Require().Equal(community.ID(), requestToJoin1.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin1.CommunityID)
|
||||||
s.Require().True(requestToJoin1.Our)
|
s.Require().True(requestToJoin1.Our)
|
||||||
|
@ -1527,7 +1527,7 @@ func (s *MessengerCommunitiesSuite) TestCancelRequestAccess() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if len(response.RequestsToJoinCommunity) == 0 {
|
if len(response.RequestsToJoinCommunity()) == 0 {
|
||||||
return errors.New("request to join community not received")
|
return errors.New("request to join community not received")
|
||||||
}
|
}
|
||||||
if len(response.ActivityCenterNotifications()) == 0 {
|
if len(response.ActivityCenterNotifications()) == 0 {
|
||||||
|
@ -1536,9 +1536,9 @@ func (s *MessengerCommunitiesSuite) TestCancelRequestAccess() {
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin2 := response.RequestsToJoinCommunity[0]
|
requestToJoin2 := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
s.Require().NotNil(requestToJoin2)
|
s.Require().NotNil(requestToJoin2)
|
||||||
s.Require().Equal(community.ID(), requestToJoin2.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin2.CommunityID)
|
||||||
|
@ -1561,8 +1561,8 @@ func (s *MessengerCommunitiesSuite) TestCancelRequestAccess() {
|
||||||
response, err = s.alice.CancelRequestToJoinCommunity(ctx, requestToCancel)
|
response, err = s.alice.CancelRequestToJoinCommunity(ctx, requestToCancel)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
s.Require().Equal(communities.RequestToJoinStateCanceled, response.RequestsToJoinCommunity[0].State)
|
s.Require().Equal(communities.RequestToJoinStateCanceled, response.RequestsToJoinCommunity()[0].State)
|
||||||
|
|
||||||
// pull to make sure it has been saved
|
// pull to make sure it has been saved
|
||||||
cancelRequestsToJoin, err := s.alice.MyCanceledRequestsToJoin()
|
cancelRequestsToJoin, err := s.alice.MyCanceledRequestsToJoin()
|
||||||
|
@ -1576,16 +1576,16 @@ func (s *MessengerCommunitiesSuite) TestCancelRequestAccess() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if len(response.RequestsToJoinCommunity) == 0 {
|
if len(response.RequestsToJoinCommunity()) == 0 {
|
||||||
return errors.New("request to join community not received")
|
return errors.New("request to join community not received")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// Retrieve activity center notifications for admin to make sure the request notification is deleted
|
// Retrieve activity center notifications for admin to make sure the request notification is deleted
|
||||||
notifications, err := s.bob.ActivityCenterNotifications(ActivityCenterNotificationsRequest{
|
notifications, err := s.bob.ActivityCenterNotifications(ActivityCenterNotificationsRequest{
|
||||||
|
@ -1598,7 +1598,7 @@ func (s *MessengerCommunitiesSuite) TestCancelRequestAccess() {
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(notifications.Notifications, 0)
|
s.Require().Len(notifications.Notifications, 0)
|
||||||
|
|
||||||
cancelRequestToJoin2 := response.RequestsToJoinCommunity[0]
|
cancelRequestToJoin2 := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
s.Require().NotNil(cancelRequestToJoin2)
|
s.Require().NotNil(cancelRequestToJoin2)
|
||||||
s.Require().Equal(community.ID(), cancelRequestToJoin2.CommunityID)
|
s.Require().Equal(community.ID(), cancelRequestToJoin2.CommunityID)
|
||||||
|
@ -1658,7 +1658,7 @@ func (s *MessengerCommunitiesSuite) TestRequestAccessAgain() {
|
||||||
response, err = s.alice.RequestToJoinCommunity(request)
|
response, err = s.alice.RequestToJoinCommunity(request)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
||||||
|
|
||||||
|
@ -1670,7 +1670,7 @@ func (s *MessengerCommunitiesSuite) TestRequestAccessAgain() {
|
||||||
s.Require().Equal(notification.Accepted, false)
|
s.Require().Equal(notification.Accepted, false)
|
||||||
s.Require().Equal(notification.Dismissed, false)
|
s.Require().Equal(notification.Dismissed, false)
|
||||||
|
|
||||||
requestToJoin1 := response.RequestsToJoinCommunity[0]
|
requestToJoin1 := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().NotNil(requestToJoin1)
|
s.Require().NotNil(requestToJoin1)
|
||||||
s.Require().Equal(community.ID(), requestToJoin1.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin1.CommunityID)
|
||||||
s.Require().True(requestToJoin1.Our)
|
s.Require().True(requestToJoin1.Our)
|
||||||
|
@ -1713,15 +1713,15 @@ func (s *MessengerCommunitiesSuite) TestRequestAccessAgain() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if len(response.RequestsToJoinCommunity) == 0 {
|
if len(response.RequestsToJoinCommunity()) == 0 {
|
||||||
return errors.New("request to join community not received")
|
return errors.New("request to join community not received")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin2 := response.RequestsToJoinCommunity[0]
|
requestToJoin2 := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
s.Require().NotNil(requestToJoin2)
|
s.Require().NotNil(requestToJoin2)
|
||||||
s.Require().Equal(community.ID(), requestToJoin2.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin2.CommunityID)
|
||||||
|
@ -1861,9 +1861,9 @@ func (s *MessengerCommunitiesSuite) TestRequestAccessAgain() {
|
||||||
response, err = s.alice.RequestToJoinCommunity(request3)
|
response, err = s.alice.RequestToJoinCommunity(request3)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin3 := response.RequestsToJoinCommunity[0]
|
requestToJoin3 := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().NotNil(requestToJoin3)
|
s.Require().NotNil(requestToJoin3)
|
||||||
s.Require().Equal(community.ID(), requestToJoin3.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin3.CommunityID)
|
||||||
s.Require().True(requestToJoin3.Our)
|
s.Require().True(requestToJoin3.Our)
|
||||||
|
@ -1884,13 +1884,15 @@ func (s *MessengerCommunitiesSuite) TestRequestAccessAgain() {
|
||||||
|
|
||||||
// Retrieve request to join
|
// Retrieve request to join
|
||||||
response, err = WaitOnMessengerResponse(s.bob,
|
response, err = WaitOnMessengerResponse(s.bob,
|
||||||
func(r *MessengerResponse) bool { return len(r.RequestsToJoinCommunity) == 1 },
|
func(r *MessengerResponse) bool {
|
||||||
|
return len(r.RequestsToJoinCommunity()) == 1
|
||||||
|
},
|
||||||
"request to join community was never 1",
|
"request to join community was never 1",
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin4 := response.RequestsToJoinCommunity[0]
|
requestToJoin4 := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
s.Require().NotNil(requestToJoin4)
|
s.Require().NotNil(requestToJoin4)
|
||||||
s.Require().Equal(community.ID(), requestToJoin4.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin4.CommunityID)
|
||||||
|
@ -1952,9 +1954,9 @@ func (s *MessengerCommunitiesSuite) TestDeclineAccess() {
|
||||||
response, err = s.alice.RequestToJoinCommunity(request)
|
response, err = s.alice.RequestToJoinCommunity(request)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin1 := response.RequestsToJoinCommunity[0]
|
requestToJoin1 := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().NotNil(requestToJoin1)
|
s.Require().NotNil(requestToJoin1)
|
||||||
s.Require().Equal(community.ID(), requestToJoin1.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin1.CommunityID)
|
||||||
s.Require().True(requestToJoin1.Our)
|
s.Require().True(requestToJoin1.Our)
|
||||||
|
@ -1997,13 +1999,13 @@ func (s *MessengerCommunitiesSuite) TestDeclineAccess() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if len(response.RequestsToJoinCommunity) == 0 {
|
if len(response.RequestsToJoinCommunity()) == 0 {
|
||||||
return errors.New("request to join community not received")
|
return errors.New("request to join community not received")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// Check if admin sees requests correctly
|
// Check if admin sees requests correctly
|
||||||
requestsToJoin, err := s.bob.PendingRequestsToJoinForCommunity(community.ID())
|
requestsToJoin, err := s.bob.PendingRequestsToJoinForCommunity(community.ID())
|
||||||
|
@ -2014,7 +2016,7 @@ func (s *MessengerCommunitiesSuite) TestDeclineAccess() {
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(requestsToJoin, 0)
|
s.Require().Len(requestsToJoin, 0)
|
||||||
|
|
||||||
requestToJoin2 := response.RequestsToJoinCommunity[0]
|
requestToJoin2 := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
s.Require().NotNil(requestToJoin2)
|
s.Require().NotNil(requestToJoin2)
|
||||||
s.Require().Equal(community.ID(), requestToJoin2.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin2.CommunityID)
|
||||||
|
@ -2687,7 +2689,7 @@ func (s *MessengerCommunitiesSuite) TestSyncCommunity_RequestToJoin() {
|
||||||
response, err = s.alice.RequestToJoinCommunity(&requests.RequestToJoinCommunity{CommunityID: community.ID()})
|
response, err = s.alice.RequestToJoinCommunity(&requests.RequestToJoinCommunity{CommunityID: community.ID()})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
||||||
|
|
||||||
|
@ -2696,7 +2698,7 @@ func (s *MessengerCommunitiesSuite) TestSyncCommunity_RequestToJoin() {
|
||||||
s.Require().Equal(notification.Type, ActivityCenterNotificationTypeCommunityRequest)
|
s.Require().Equal(notification.Type, ActivityCenterNotificationTypeCommunityRequest)
|
||||||
s.Require().Equal(notification.MembershipStatus, ActivityCenterMembershipStatusPending)
|
s.Require().Equal(notification.MembershipStatus, ActivityCenterMembershipStatusPending)
|
||||||
|
|
||||||
aRtj := response.RequestsToJoinCommunity[0]
|
aRtj := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().NotNil(aRtj)
|
s.Require().NotNil(aRtj)
|
||||||
s.Equal(community.ID(), aRtj.CommunityID)
|
s.Equal(community.ID(), aRtj.CommunityID)
|
||||||
s.True(aRtj.Our)
|
s.True(aRtj.Our)
|
||||||
|
@ -2780,16 +2782,16 @@ func (s *MessengerCommunitiesSuite) TestSyncCommunity_RequestToJoin() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if len(response.RequestsToJoinCommunity) == 0 {
|
if len(response.RequestsToJoinCommunity()) == 0 {
|
||||||
return errors.New("request to join community not received")
|
return errors.New("request to join community not received")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Len(response.RequestsToJoinCommunity, 1)
|
s.Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
// Check that bob the admin's newly received request to join matches what we expect
|
// Check that bob the admin's newly received request to join matches what we expect
|
||||||
bobRtj := response.RequestsToJoinCommunity[0]
|
bobRtj := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().NotNil(bobRtj)
|
s.Require().NotNil(bobRtj)
|
||||||
s.Equal(community.ID(), bobRtj.CommunityID)
|
s.Equal(community.ID(), bobRtj.CommunityID)
|
||||||
s.False(bobRtj.Our)
|
s.False(bobRtj.Our)
|
||||||
|
@ -3717,9 +3719,9 @@ func (s *MessengerCommunitiesSuite) TestRequestAndCancelCommunityAdminOffline()
|
||||||
response, err := s.alice.RequestToJoinCommunity(request)
|
response, err := s.alice.RequestToJoinCommunity(request)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin1 := response.RequestsToJoinCommunity[0]
|
requestToJoin1 := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().NotNil(requestToJoin1)
|
s.Require().NotNil(requestToJoin1)
|
||||||
s.Require().Equal(community.ID(), requestToJoin1.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin1.CommunityID)
|
||||||
s.Require().True(requestToJoin1.Our)
|
s.Require().True(requestToJoin1.Our)
|
||||||
|
@ -3775,7 +3777,7 @@ func (s *MessengerCommunitiesSuite) TestRequestAndCancelCommunityAdminOffline()
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(requestsToJoin, 1)
|
s.Require().Len(requestsToJoin, 1)
|
||||||
|
|
||||||
requestToJoin2 := response.RequestsToJoinCommunity[0]
|
requestToJoin2 := response.RequestsToJoinCommunity()[0]
|
||||||
|
|
||||||
s.Require().NotNil(requestToJoin2)
|
s.Require().NotNil(requestToJoin2)
|
||||||
s.Require().Equal(community.ID(), requestToJoin2.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin2.CommunityID)
|
||||||
|
@ -3790,8 +3792,8 @@ func (s *MessengerCommunitiesSuite) TestRequestAndCancelCommunityAdminOffline()
|
||||||
response, err = s.alice.CancelRequestToJoinCommunity(ctx, requestToCancel)
|
response, err = s.alice.CancelRequestToJoinCommunity(ctx, requestToCancel)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
s.Require().Equal(communities.RequestToJoinStateCanceled, response.RequestsToJoinCommunity[0].State)
|
s.Require().Equal(communities.RequestToJoinStateCanceled, response.RequestsToJoinCommunity()[0].State)
|
||||||
|
|
||||||
messageState = s.alice.buildMessageState()
|
messageState = s.alice.buildMessageState()
|
||||||
messageState.CurrentMessageState = &CurrentMessageState{}
|
messageState.CurrentMessageState = &CurrentMessageState{}
|
||||||
|
@ -3858,7 +3860,7 @@ func (s *MessengerCommunitiesSuite) TestRequestAndCancelCommunityAdminOffline()
|
||||||
|
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(notifications.Notifications, 0)
|
s.Require().Len(notifications.Notifications, 0)
|
||||||
cancelRequestToJoin2 := response.RequestsToJoinCommunity[0]
|
cancelRequestToJoin2 := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().NotNil(cancelRequestToJoin2)
|
s.Require().NotNil(cancelRequestToJoin2)
|
||||||
s.Require().Equal(community.ID(), cancelRequestToJoin2.CommunityID)
|
s.Require().Equal(community.ID(), cancelRequestToJoin2.CommunityID)
|
||||||
s.Require().False(cancelRequestToJoin2.Our)
|
s.Require().False(cancelRequestToJoin2.Our)
|
||||||
|
|
|
@ -388,9 +388,9 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) TestRequestAccessWithENSToke
|
||||||
response, err = s.alice.RequestToJoinCommunity(requestToJoin)
|
response, err = s.alice.RequestToJoinCommunity(requestToJoin)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin1 := response.RequestsToJoinCommunity[0]
|
requestToJoin1 := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().Equal(communities.RequestToJoinStatePending, requestToJoin1.State)
|
s.Require().Equal(communities.RequestToJoinStatePending, requestToJoin1.State)
|
||||||
|
|
||||||
// Retrieve request to join
|
// Retrieve request to join
|
||||||
|
|
|
@ -479,7 +479,7 @@ func (m *Messenger) handleCommunitiesSubscription(c chan *communities.Subscripti
|
||||||
m.AddActivityCenterNotificationToResponse(communityResponse.Community.IDString(), ActivityCenterNotificationTypeShareAccounts, response)
|
m.AddActivityCenterNotificationToResponse(communityResponse.Community.IDString(), ActivityCenterNotificationTypeShareAccounts, response)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
state.Response.RequestsToJoinCommunity = append(state.Response.RequestsToJoinCommunity, requestToJoin)
|
state.Response.AddRequestToJoinCommunity(requestToJoin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1201,7 +1201,8 @@ func (m *Messenger) RequestToJoinCommunity(request *requests.RequestToJoinCommun
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
response := &MessengerResponse{RequestsToJoinCommunity: []*communities.RequestToJoin{requestToJoin}}
|
response := &MessengerResponse{}
|
||||||
|
response.AddRequestToJoinCommunity(requestToJoin)
|
||||||
response.AddCommunity(community)
|
response.AddCommunity(community)
|
||||||
|
|
||||||
// We send a push notification in the background
|
// We send a push notification in the background
|
||||||
|
@ -1509,7 +1510,7 @@ func (m *Messenger) CancelRequestToJoinCommunity(ctx context.Context, request *r
|
||||||
|
|
||||||
response := &MessengerResponse{}
|
response := &MessengerResponse{}
|
||||||
response.AddCommunity(community)
|
response.AddCommunity(community)
|
||||||
response.RequestsToJoinCommunity = append(response.RequestsToJoinCommunity, requestToJoin)
|
response.AddRequestToJoinCommunity(requestToJoin)
|
||||||
|
|
||||||
// delete activity center notification
|
// delete activity center notification
|
||||||
notification, err := m.persistence.GetActivityCenterNotificationByID(requestToJoin.ID)
|
notification, err := m.persistence.GetActivityCenterNotificationByID(requestToJoin.ID)
|
||||||
|
|
|
@ -1463,7 +1463,7 @@ func (m *Messenger) HandleCommunityCancelRequestToJoin(state *ReceivedMessageSta
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
state.Response.RequestsToJoinCommunity = append(state.Response.RequestsToJoinCommunity, requestToJoin)
|
state.Response.AddRequestToJoinCommunity(requestToJoin)
|
||||||
|
|
||||||
// delete activity center notification
|
// delete activity center notification
|
||||||
notification, err := m.persistence.GetActivityCenterNotificationByID(requestToJoin.ID)
|
notification, err := m.persistence.GetActivityCenterNotificationByID(requestToJoin.ID)
|
||||||
|
@ -1510,10 +1510,7 @@ func (m *Messenger) HandleCommunityRequestToJoin(state *ReceivedMessageState, re
|
||||||
state.ModifiedContacts.Store(contact.ID, true)
|
state.ModifiedContacts.Store(contact.ID, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if state.Response.RequestsToJoinCommunity == nil {
|
state.Response.AddRequestToJoinCommunity(requestToJoin)
|
||||||
state.Response.RequestsToJoinCommunity = make([]*communities.RequestToJoin, 0)
|
|
||||||
}
|
|
||||||
state.Response.RequestsToJoinCommunity = append(state.Response.RequestsToJoinCommunity, requestToJoin)
|
|
||||||
|
|
||||||
state.Response.AddNotification(NewCommunityRequestToJoinNotification(requestToJoin.ID.String(), community, contact))
|
state.Response.AddNotification(NewCommunityRequestToJoinNotification(requestToJoin.ID.String(), community, contact))
|
||||||
|
|
||||||
|
@ -1626,7 +1623,7 @@ func (m *Messenger) HandleCommunityRequestToJoinResponse(state *ReceivedMessageS
|
||||||
}
|
}
|
||||||
|
|
||||||
if updatedRequest != nil {
|
if updatedRequest != nil {
|
||||||
state.Response.RequestsToJoinCommunity = append(state.Response.RequestsToJoinCommunity, updatedRequest)
|
state.Response.AddRequestToJoinCommunity(updatedRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
community, err := m.communitiesManager.GetByID(requestToJoinResponseProto.CommunityId)
|
community, err := m.communitiesManager.GetByID(requestToJoinResponseProto.CommunityId)
|
||||||
|
|
|
@ -47,7 +47,6 @@ type MessengerResponse struct {
|
||||||
Installations []*multidevice.Installation
|
Installations []*multidevice.Installation
|
||||||
Invitations []*GroupChatInvitation
|
Invitations []*GroupChatInvitation
|
||||||
CommunityChanges []*communities.CommunityChanges
|
CommunityChanges []*communities.CommunityChanges
|
||||||
RequestsToJoinCommunity []*communities.RequestToJoin
|
|
||||||
AnonymousMetrics []*appmetrics.AppMetric
|
AnonymousMetrics []*appmetrics.AppMetric
|
||||||
Mailservers []mailservers.Mailserver
|
Mailservers []mailservers.Mailserver
|
||||||
Bookmarks []*browsers.Bookmark
|
Bookmarks []*browsers.Bookmark
|
||||||
|
@ -67,6 +66,7 @@ type MessengerResponse struct {
|
||||||
// notifications a list of notifications derived from messenger events
|
// notifications a list of notifications derived from messenger events
|
||||||
// that are useful to notify the user about
|
// that are useful to notify the user about
|
||||||
notifications map[string]*localnotifications.Notification
|
notifications map[string]*localnotifications.Notification
|
||||||
|
requestsToJoinCommunity map[string]*communities.RequestToJoin
|
||||||
chats map[string]*Chat
|
chats map[string]*Chat
|
||||||
removedChats map[string]bool
|
removedChats map[string]bool
|
||||||
removedMessages map[string]*RemovedMessage
|
removedMessages map[string]*RemovedMessage
|
||||||
|
@ -142,7 +142,7 @@ func (r *MessengerResponse) MarshalJSON() ([]byte, error) {
|
||||||
Installations: r.Installations,
|
Installations: r.Installations,
|
||||||
Invitations: r.Invitations,
|
Invitations: r.Invitations,
|
||||||
CommunityChanges: r.CommunityChanges,
|
CommunityChanges: r.CommunityChanges,
|
||||||
RequestsToJoinCommunity: r.RequestsToJoinCommunity,
|
RequestsToJoinCommunity: r.RequestsToJoinCommunity(),
|
||||||
Mailservers: r.Mailservers,
|
Mailservers: r.Mailservers,
|
||||||
Bookmarks: r.Bookmarks,
|
Bookmarks: r.Bookmarks,
|
||||||
CurrentStatus: r.currentStatus,
|
CurrentStatus: r.currentStatus,
|
||||||
|
@ -303,7 +303,7 @@ func (r *MessengerResponse) IsEmpty() bool {
|
||||||
len(r.activityCenterNotifications)+
|
len(r.activityCenterNotifications)+
|
||||||
len(r.trustStatus)+
|
len(r.trustStatus)+
|
||||||
len(r.verificationRequests)+
|
len(r.verificationRequests)+
|
||||||
len(r.RequestsToJoinCommunity)+
|
len(r.requestsToJoinCommunity)+
|
||||||
len(r.savedAddresses)+
|
len(r.savedAddresses)+
|
||||||
len(r.updatedProfileShowcases)+
|
len(r.updatedProfileShowcases)+
|
||||||
len(r.seenAndUnseenMessages)+
|
len(r.seenAndUnseenMessages)+
|
||||||
|
@ -342,7 +342,7 @@ func (r *MessengerResponse) Merge(response *MessengerResponse) error {
|
||||||
r.AddInstallations(response.Installations)
|
r.AddInstallations(response.Installations)
|
||||||
r.AddSavedAddresses(response.SavedAddresses())
|
r.AddSavedAddresses(response.SavedAddresses())
|
||||||
r.AddEnsUsernameDetails(response.EnsUsernameDetails())
|
r.AddEnsUsernameDetails(response.EnsUsernameDetails())
|
||||||
r.AddRequestsToJoinCommunity(response.RequestsToJoinCommunity)
|
r.AddRequestsToJoinCommunity(response.RequestsToJoinCommunity())
|
||||||
r.AddBookmarks(response.GetBookmarks())
|
r.AddBookmarks(response.GetBookmarks())
|
||||||
r.AddProfileShowcases(response.GetUpdatedProfileShowcases())
|
r.AddProfileShowcases(response.GetUpdatedProfileShowcases())
|
||||||
r.AddSeveralSeenAndUnseenMessages(response.GetSeenAndUnseenMessages())
|
r.AddSeveralSeenAndUnseenMessages(response.GetSeenAndUnseenMessages())
|
||||||
|
@ -388,11 +388,25 @@ func (r *MessengerResponse) UpdateCommunitySettings(communitySettings []*communi
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *MessengerResponse) AddRequestsToJoinCommunity(requestsToJoin []*communities.RequestToJoin) {
|
func (r *MessengerResponse) AddRequestsToJoinCommunity(requestsToJoin []*communities.RequestToJoin) {
|
||||||
r.RequestsToJoinCommunity = append(r.RequestsToJoinCommunity, requestsToJoin...)
|
for _, rq := range requestsToJoin {
|
||||||
|
r.AddRequestToJoinCommunity(rq)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *MessengerResponse) AddRequestToJoinCommunity(requestToJoin *communities.RequestToJoin) {
|
func (r *MessengerResponse) AddRequestToJoinCommunity(requestToJoin *communities.RequestToJoin) {
|
||||||
r.RequestsToJoinCommunity = append(r.RequestsToJoinCommunity, requestToJoin)
|
if r.requestsToJoinCommunity == nil {
|
||||||
|
r.requestsToJoinCommunity = make(map[string]*communities.RequestToJoin)
|
||||||
|
}
|
||||||
|
r.requestsToJoinCommunity[requestToJoin.ID.String()] = requestToJoin
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *MessengerResponse) RequestsToJoinCommunity() []*communities.RequestToJoin {
|
||||||
|
var rs []*communities.RequestToJoin
|
||||||
|
for _, r := range r.requestsToJoinCommunity {
|
||||||
|
rs = append(rs, r)
|
||||||
|
}
|
||||||
|
|
||||||
|
return rs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *MessengerResponse) AddSetting(s *settings.SyncSettingField) {
|
func (r *MessengerResponse) AddSetting(s *settings.SyncSettingField) {
|
||||||
|
|
|
@ -947,9 +947,9 @@ func (s *MessengerPushNotificationSuite) TestReceivePushNotificationCommunityReq
|
||||||
response, err = alice.RequestToJoinCommunity(request)
|
response, err = alice.RequestToJoinCommunity(request)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().NotNil(response)
|
s.Require().NotNil(response)
|
||||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
s.Require().Len(response.RequestsToJoinCommunity(), 1)
|
||||||
|
|
||||||
requestToJoin1 := response.RequestsToJoinCommunity[0]
|
requestToJoin1 := response.RequestsToJoinCommunity()[0]
|
||||||
s.Require().NotNil(requestToJoin1)
|
s.Require().NotNil(requestToJoin1)
|
||||||
s.Require().Equal(community.ID(), requestToJoin1.CommunityID)
|
s.Require().Equal(community.ID(), requestToJoin1.CommunityID)
|
||||||
s.Require().True(requestToJoin1.Our)
|
s.Require().True(requestToJoin1.Our)
|
||||||
|
|
Loading…
Reference in New Issue