Repository navigation
Todo
Labels
featureNew feature or request
Description
Description and motivation
Team managers cannot delete a team. Only an admin can do it, through the Django admin. #569 says managers should be able to delete their teams, and Adrian raised this again in the review of #906 (team creation for #705).
Proposed approach
Managers already get the delete_team object permission through their membership, so the permission check is in place. What is missing:
- A
delete_team()function inmain/team_services.pythat checks the person is a manager and deletes the team. When a team is deleted, its memberships are deleted with it, and the existingpre_deletesignal onTeamremoves its Guardian permissions. - A view at
teams/<slug>/delete/that shows a confirmation page on GET and deletes on POST. It requires thedelete_teamobject permission, and returns a 404 to anyone else. - A Delete team button (
btn-danger) at the bottom of the team page, shown only to managers. - After deleting, redirect to My Teams with a success message.
Questions to settle before building:
- Is a simple "Are you sure?" page enough, or should the manager type the team name to confirm?
- Should any manager be able to delete the team, or only when they are the sole manager?
Acceptance criteria
- A manager can delete a team after confirming, and is redirected to My Teams.
- The team, its memberships and its Guardian permissions are all removed.
- Existing invitation links for the deleted team show the invalid link page.
- Regular members do not see the button, and GET or POST to the view returns a 404 for them.
- People outside the team get a 404.
- Service and view tests follow
docs/dev-guide/testing.md.
Affected areas
Services (main/team_services.py), views, URLs, team page template, new confirmation template, tests, docs/dev-guide/architecture.md.
Additional context
Deleting a team cannot be undone, so the confirmation step matters.
Metadata
Metadata
Assignees
Labels
featureNew feature or request
Type
Projects
- StatusShow more project fields📋 Backlog
Activity