aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorOtto Richter (fnetX) <github@fralix.ovh>2022-03-09 01:38:11 +0100
committerGitHub <noreply@github.com>2022-03-09 01:38:11 +0100
commitea46142bcea6084e50a11baf048f8eb8862285c7 (patch)
tree0b269d8e46c824e3a76ab1432cd528493de2b4c6 /routers
parentddf7f1319f70e124acfd1e8e86dff4ff87290f51 (diff)
downloadgitea-ea46142bcea6084e50a11baf048f8eb8862285c7.tar.gz
gitea-ea46142bcea6084e50a11baf048f8eb8862285c7.zip
Add button for issue deletion (#19032)
Co-authored-by: Norwin <noerw@users.noreply.github.com> Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/issue.go15
-rw-r--r--routers/web/web.go1
2 files changed, 16 insertions, 0 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index d0c3d3325a..a81b1f1962 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -852,6 +852,21 @@ func NewIssueChooseTemplate(ctx *context.Context) {
ctx.HTML(http.StatusOK, tplIssueChoose)
}
+// DeleteIssue deletes an issue
+func DeleteIssue(ctx *context.Context) {
+ issue := GetActionIssue(ctx)
+ if ctx.Written() {
+ return
+ }
+
+ if err := issue_service.DeleteIssue(ctx.User, ctx.Repo.GitRepo, issue); err != nil {
+ ctx.ServerError("DeleteIssueByID", err)
+ return
+ }
+
+ ctx.Redirect(fmt.Sprintf("%s/issues", ctx.Repo.Repository.HTMLURL()), http.StatusSeeOther)
+}
+
// ValidateRepoMetas check and returns repository's meta information
func ValidateRepoMetas(ctx *context.Context, form forms.CreateIssueForm, isPull bool) ([]int64, []int64, int64, int64) {
var (
diff --git a/routers/web/web.go b/routers/web/web.go
index d8c197fb96..9faa61e560 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -757,6 +757,7 @@ func RegisterRoutes(m *web.Route) {
m.Post("/reactions/{action}", bindIgnErr(forms.ReactionForm{}), repo.ChangeIssueReaction)
m.Post("/lock", reqRepoIssueWriter, bindIgnErr(forms.IssueLockForm{}), repo.LockIssue)
m.Post("/unlock", reqRepoIssueWriter, repo.UnlockIssue)
+ m.Post("/delete", reqRepoAdmin, repo.DeleteIssue)
}, context.RepoMustNotBeArchived())
m.Group("/{index}", func() {
m.Get("/attachments", repo.GetIssueAttachments)