fix(groups): add repair step for group circles sync and adjust 'circles:sync --groups' command #2317
+65
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes group to circle sync for groups created while Circles (teams) app was disabled. When such groups are added to teams, their members now correctly appear as team members.
Problem
When a group is created and populated while the Circles app is disabled and later added to a team, the group members are not synced to the team, so users don't see themselves as team members.
As reported in issue #2291, removing/adding a user from a group again while Circles is enabled and then adding that group to a team would correctly sync the users.
Also reported that running
circles:sync --groupsshould fix this situation, but in my case that did not work. I had to adjust the sync method to not rely on member count to sync (removed the count if statment), as it was counting app type as a member and entering here and returning earlier without actually updating the memberships of a circle:With this adjustment I was able to correctly sync groups created before circles was enabled.
Also, as requested on the issue, a repair step was added, and basically what it does is trigger a single background job that runs the same method as
circles:sync --groups, resulting in the same behaviour.Testing
To test this, I did the reproduction steps described on the issue:
To fix that the following can be done (this is what this PR implements):
Get the id from
OCA\Circles\BackgroundJob\SyncGroupCirclesJobjobAfter execute runs, if you refresh the "TestUser" contacts page you should see that now the "TestTeam" appears as a team where "TestUser" belongs.
Instead of executing the repair step,
circles:sync --groupscan also be runned to test and achieve the same result.Checklist
3. to review, feature component)stable32)