Skip to content

Conversation

@cristianscheid
Copy link
Contributor

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 --groups should 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:

if ($group->count() <= count($members)) {
    return $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:

  1. Disable circles
  2. Create a group "TestGroup" and add "TestUser" to it
  3. Enable circles
  4. As "SomeoneElse" create team "TestTeam" and add "TestGroup"
  5. As "TestUser" look in the contacts app what teams you're part of
  6. Result: "TestTeam" does not appear as a team "TestUser" is part of

To fix that the following can be done (this is what this PR implements):

occ maintenance:repair
occ background-job:list

Get the id from OCA\Circles\BackgroundJob\SyncGroupCirclesJob job

occ background-job:execute <sync-group-circles-job-id>

After 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 --groups can also be runned to test and achieve the same result.

Checklist

…--groups' command

Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
@provokateurin provokateurin merged commit fc0d2b7 into master Jan 26, 2026
42 of 44 checks passed
@provokateurin provokateurin deleted the fix/2291/sync-groups-repair-step branch January 26, 2026 11:10
@cristianscheid cristianscheid self-assigned this Jan 26, 2026
@cristianscheid
Copy link
Contributor Author

/backport to stable32

@cristianscheid
Copy link
Contributor Author

/backport to stable31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Groups created while circles was disabled don't function as group-circles

3 participants