forked from forgejo/forgejo
Add ability to delete single wiki pages.
This commit is contained in:
parent
f6759a731a
commit
1ca171dbe9
6 changed files with 761 additions and 906 deletions
|
@ -256,3 +256,21 @@ func EditWikiPost(ctx *middleware.Context, form auth.NewWikiForm) {
|
|||
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + models.ToWikiPageURL(form.Title))
|
||||
}
|
||||
|
||||
func DeleteWikiPagePost(ctx *middleware.Context, form auth.NewWikiForm) {
|
||||
pageURL := ctx.Params(":page")
|
||||
if len(pageURL) == 0 {
|
||||
pageURL = "Home"
|
||||
}
|
||||
|
||||
pageName := models.ToWikiPageName(pageURL)
|
||||
|
||||
if err := ctx.Repo.Repository.DeleteWikiPage(ctx.User, pageName); err != nil {
|
||||
ctx.Handle(500, "DeleteWikiPage", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"redirect": ctx.Repo.RepoLink + "/wiki/",
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue