1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Finish delete organization

This commit is contained in:
Unknown
2014-06-28 00:40:07 -04:00
parent ee9b7f322f
commit 6e448b0714
11 changed files with 116 additions and 27 deletions

View File

@@ -122,13 +122,23 @@ func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) {
return
}
if err := models.DeleteRepository(ctx.User.Id, ctx.Repo.Repository.Id, ctx.User.LowerName); err != nil {
ctx.Handle(500, "setting.Delete", err)
if ctx.Repo.Owner.IsOrganization() &&
!models.IsOrganizationOwner(ctx.Repo.Owner.Id, ctx.User.Id) {
ctx.Error(403)
return
}
log.Trace("%s Repository deleted: %s/%s", ctx.Req.RequestURI, ctx.User.LowerName, ctx.Repo.Repository.LowerName)
ctx.Redirect("/")
if err := models.DeleteRepository(ctx.Repo.Owner.Id, ctx.Repo.Repository.Id, ctx.Repo.Owner.Name); err != nil {
ctx.Handle(500, "setting.Delete(DeleteRepository)", err)
return
}
log.Trace("%s Repository deleted: %s/%s", ctx.Req.RequestURI, ctx.Repo.Owner.LowerName, ctx.Repo.Repository.LowerName)
if ctx.Repo.Owner.IsOrganization() {
ctx.Redirect("/org/" + ctx.Repo.Owner.Name + "/dashboard")
} else {
ctx.Redirect("/")
}
}
}