Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 404 error when leaving the last private org team #24322

Merged
10 changes: 9 additions & 1 deletion routers/web/org/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,17 @@ func TeamsAction(ctx *context.Context) {
return
}
}

redirect := ctx.Org.OrgLink + "/teams/"
if isOrgMember, err := org_model.IsOrganizationMember(ctx, ctx.Org.Organization.ID, ctx.Doer.ID); err != nil {
ctx.ServerError("IsOrganizationMember", err)
return
} else if !isOrgMember {
redirect = setting.AppSubURL + "/"
}
ctx.JSON(http.StatusOK,
map[string]interface{}{
"redirect": ctx.Org.OrgLink + "/teams/",
"redirect": redirect,
})
return
case "remove":
Expand Down