diff options
author | Josh Frye <joshfng@gmail.com> | 2016-03-03 15:38:25 -0500 |
---|---|---|
committer | Josh Frye <joshfng@gmail.com> | 2016-03-03 16:12:48 -0500 |
commit | f3358f5927c7947c90b921371e589cb73c70e1cc (patch) | |
tree | 4e23d990586b5f91f9f3e46ad6742d755b589c2c /routers/repo | |
parent | f946040fa94a3acb3b1f54873e6f95766595829c (diff) | |
download | gitea-f3358f5927c7947c90b921371e589cb73c70e1cc.tar.gz gitea-f3358f5927c7947c90b921371e589cb73c70e1cc.zip |
Repo setting to delete and disable wiki
Diffstat (limited to 'routers/repo')
-rw-r--r-- | routers/repo/setting.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 5f268f3bfb..711d6e2b66 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -226,6 +226,32 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) { ctx.Flash.Success(ctx.Tr("repo.settings.deletion_success")) ctx.Redirect(ctx.Repo.Owner.DashboardLink()) + case "delete-wiki": + if repo.Name != form.RepoName { + ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil) + return + } + + if ctx.Repo.Owner.IsOrganization() { + if !ctx.Repo.Owner.IsOwnedBy(ctx.User.Id) { + ctx.Error(404) + return + } + } + + models.DeleteWiki(repo) + log.Trace("Repository wiki deleted: %s/%s", ctx.Repo.Owner.Name, repo.Name) + + repo.EnableWiki = false + + if err := models.UpdateRepository(repo, false); err != nil { + ctx.Handle(500, "UpdateRepository", err) + return + } + log.Trace("Repository advanced settings updated: %s/%s", ctx.Repo.Owner.Name, repo.Name) + + ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success")) + ctx.Redirect(ctx.Repo.RepoLink + "/settings") } } |