[Fixes: #4206] Don't remove filters if not needed

Filters were removed and recreated which resulted in a flaky test.
This was not needed as the filters didn't change, and they won't be
recreated if we reinstall the same filter.
This commit is contained in:
Andrea Maria Piana 2023-11-01 12:01:51 +00:00
parent eb437e9d8d
commit fd76367be7
No known key found for this signature in database
2 changed files with 4 additions and 8 deletions

View file

@ -1368,7 +1368,9 @@ func testRejectMemberRequestToJoin(base CommunityEventsTestsInterface, community
response, err = WaitOnMessengerResponse(
base.GetControlNode(),
func(r *MessengerResponse) bool {
return len(r.Communities()) > 0 && !r.Communities()[0].HasMember(&user.identity.PublicKey)
requests, err := base.GetControlNode().DeclinedRequestsToJoinForCommunity(community.ID())
s.Require().NoError(err)
return len(response.Communities()) == 1 && len(requests) == 1
},
"control node did not receive community request to join update from event sender",
)

View file

@ -2110,13 +2110,7 @@ func (m *Messenger) UpdateCommunityFilters(community *communities.Community, pri
publicFiltersToInit := make([]transport.FiltersToInitialize, 0, len(community.DefaultFilters())+len(community.Chats()))
for _, df := range community.DefaultFilters() {
_, err := m.transport.RemoveFilterByChatID(df.ChatID)
if err != nil {
return err
}
publicFiltersToInit = append(publicFiltersToInit, df)
}
publicFiltersToInit = append(publicFiltersToInit, community.DefaultFilters()...)
for chatID := range community.Chats() {
communityChatID := community.IDString() + chatID