Add APIv4 endpoint to permanently delete teams (#6604)
Tests are added, however, it only tests the property if its soft deleted. In the background it will be hard deleted, but that is untestable through a integration test.
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
98ac903fce
Коммит
0c04c5334f
12
api4/team.go
12
api4/team.go
@@ -30,7 +30,7 @@ func InitTeam() {
|
||||
|
||||
BaseRoutes.Team.Handle("", ApiSessionRequired(getTeam)).Methods("GET")
|
||||
BaseRoutes.Team.Handle("", ApiSessionRequired(updateTeam)).Methods("PUT")
|
||||
BaseRoutes.Team.Handle("", ApiSessionRequired(softDeleteTeam)).Methods("DELETE")
|
||||
BaseRoutes.Team.Handle("", ApiSessionRequired(deleteTeam)).Methods("DELETE")
|
||||
BaseRoutes.Team.Handle("/patch", ApiSessionRequired(patchTeam)).Methods("PUT")
|
||||
BaseRoutes.Team.Handle("/stats", ApiSessionRequired(getTeamStats)).Methods("GET")
|
||||
BaseRoutes.TeamMembers.Handle("", ApiSessionRequired(getTeamMembers)).Methods("GET")
|
||||
@@ -172,7 +172,7 @@ func patchTeam(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(patchedTeam.ToJson()))
|
||||
}
|
||||
|
||||
func softDeleteTeam(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
func deleteTeam(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.RequireTeamId()
|
||||
if c.Err != nil {
|
||||
return
|
||||
@@ -183,7 +183,13 @@ func softDeleteTeam(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
err := app.SoftDeleteTeam(c.Params.TeamId)
|
||||
var err *model.AppError
|
||||
if c.Params.Permanent {
|
||||
err = app.PermanentDeleteTeamId(c.Params.TeamId)
|
||||
} else {
|
||||
err = app.SoftDeleteTeam(c.Params.TeamId)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
|
||||
Ссылка в новой задаче
Block a user