From f3358f5927c7947c90b921371e589cb73c70e1cc Mon Sep 17 00:00:00 2001 From: Josh Frye Date: Thu, 3 Mar 2016 15:38:25 -0500 Subject: Repo setting to delete and disable wiki --- models/repo.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'models') diff --git a/models/repo.go b/models/repo.go index 22336d3c..4d37c6e9 100644 --- a/models/repo.go +++ b/models/repo.go @@ -241,6 +241,17 @@ func (repo *Repository) ComposeMetas() map[string]string { return repo.ExternalMetas } +func DeleteWiki(repo *Repository) { + repo.DeleteWiki() +} + +func (repo *Repository) DeleteWiki() { + wikiPaths := []string{repo.WikiPath(), repo.LocalWikiPath()} + for _, wikiPath := range wikiPaths { + RemoveAllWithNotice("Delete repository wiki", wikiPath) + } +} + // GetAssignees returns all users that have write access of repository. func (repo *Repository) GetAssignees() (_ []*User, err error) { if err = repo.GetOwner(); err != nil { @@ -1335,10 +1346,7 @@ func DeleteRepository(uid, repoID int64) error { repoPath := repo.repoPath(sess) RemoveAllWithNotice("Delete repository files", repoPath) - wikiPaths := []string{repo.WikiPath(), repo.LocalWikiPath()} - for _, wikiPath := range wikiPaths { - RemoveAllWithNotice("Delete repository wiki", wikiPath) - } + repo.DeleteWiki() // Remove attachment files. for i := range attachmentPaths { -- cgit v1.2.3