Skip to content

feat: add event handling to auto create teamfolders upon circle creation - #4941

Open
stediefan wants to merge 3 commits into
nextcloud:masterfrom
Dataport:feature/teams-auto-folder-creation
Open

feat: add event handling to auto create teamfolders upon circle creation#4941
stediefan wants to merge 3 commits into
nextcloud:masterfrom
Dataport:feature/teams-auto-folder-creation

Conversation

@stediefan

@stediefan stediefan commented Jul 24, 2026

Copy link
Copy Markdown

feat: add team_circle_id flag to teamfolder to uniquely link a team
feat: adminUI: add filters for classic teamfolders and the newly linked ones
todo: sensible naming for the two types of folders

Assisted by: GitHub Copilot:Claude Sonnet 5
Assisted by: GitHub Copilot:GPT-5.6 Terra
Assisted by: GitHub Copilot:Kimi K2.7 Code

Related Issues in Circles:
nextcloud/circles#2661
nextcloud/circles#2663
nextcloud/circles#2669

Related Pull Request in server: nextcloud/server#62476
Related Pull Request in circles: nextcloud/circles#2675

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

… upon circle creation

feat: add team_circle_id flag to teamfolder to uniquely link a team
feat: adminUI: add filters for classic teamfolders and the newly linked ones
todo: sensible naming for the two types of folders

Assisted by: GitHub Copilot:Claude Sonnet 5
Assisted by: GitHub Copilot:GPT-5.6 Terra
Assisted by: GitHub Copilot:Kimi K2.7 Code
Signed-off-by: Stefan Dietrich <5716289+stediefan@users.noreply.github.com>
@stediefan
stediefan force-pushed the feature/teams-auto-folder-creation branch 2 times, most recently from c296a5d to 89077f1 Compare July 24, 2026 09:53
Comment thread lib/Command/ACL.php Outdated
}

if (!$table->hasIndex('group_folders_team_circle')) {
$table->addUniqueIndex(['team_circle_id'], 'group_folders_team_circle');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as I can see, this wasn't enforced previously with the options.circle_id, so this might cause some issues

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was some additional code I overlooked. Should be more concise now:
This index belongs to a new property that links the folder 1:1 to a team. As the property is newly created we shouldn't have any issues here.

Comment thread tests/stubs/ocp_teams_ifolderprovider.php Outdated
@stediefan
stediefan force-pushed the feature/teams-auto-folder-creation branch from 89077f1 to 6243fc7 Compare July 27, 2026 09:28
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: Stefan Dietrich <5716289+stediefan@users.noreply.github.com>
@stediefan
stediefan force-pushed the feature/teams-auto-folder-creation branch from 6243fc7 to 8bc6323 Compare July 27, 2026 09:47
Comment thread lib/TeamSpace/TeamSpaceProvider.php Outdated
Signed-off-by: Stefan Dietrich <5716289+stediefan@users.noreply.github.com>
/**
* Introduces the `team_circle_id` column on `group_folders` so that the
* "this folder belongs to a team" relationship is stored as an explicit,
* indexed, queryable column.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could not be done with the goup_folders_groups table?
Is goup_folders_groups still populated with the circle ID?

I fear that not populating goup_folders_groups could lead to subtle bugs as the code base currently assume that it is the source of truth.

I would rather add a column in the group_folders table to denote that a groupfolders assignment is limited to one group/circles only.

What do you think?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Group_folders_groups is still populated via createTeamSpace() calling addApplicableGroup() (lib/TeamSpace/TeamSpaceService.php:58), so existing access and membership paths like getFoldersFromCircleMemberships() should continue to work without changes.

Team_circle_id is not a replacement for group_folders_groups. It indicates the ownership of the groupfolder in contrast to the Multi mounting prior (which is still possible with the non team-owned folders). Combining these in group_folders_groups.circle_id causes issues when admins assign multiple circles or re-add an owning circle. The unique index on team_circle_id also enforces "one team space per team" at the database level.

A boolean is_team_space column would still require a separate lookup to find the owning circle, whereas team_circle_id serves as both the flag and the reference in a single indexed read.

Both stores are synchronized: unlinkTeamSpace() clears team_circle_id and removes the group_folders_groups row (lib/TeamSpace/TeamSpaceService.php:122-123), maintaining group_folders_groups for all previous use cases and team_circle_id for the ownership.

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.

3 participants