diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-06-19 15:46:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-19 15:46:50 +0800 |
commit | a1c5057fe81c25dfd1777e9625eb5480c45897ea (patch) | |
tree | 5e25321082e6f3e5b5255132af825cb0b3a3248e /routers | |
parent | 51c2aebe1f5124f1a93f7ccd082792c26e6da291 (diff) | |
download | gitea-a1c5057fe81c25dfd1777e9625eb5480c45897ea.tar.gz gitea-a1c5057fe81c25dfd1777e9625eb5480c45897ea.zip |
Batch delete issue and improve tippy opts (#25253)
1. Add "batch delete" button for selected issues, close #22273
2. Address the review in
https://github.com/go-gitea/gitea/pull/25219#discussion_r1229266083
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/repo/issue.go | 18 | ||||
-rw-r--r-- | routers/web/web.go | 1 |
2 files changed, 16 insertions, 3 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 9f087edc72..49ba753a7d 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -2705,6 +2705,20 @@ func ListIssues(ctx *context.Context) { ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues)) } +func BatchDeleteIssues(ctx *context.Context) { + issues := getActionIssues(ctx) + if ctx.Written() { + return + } + for _, issue := range issues { + if err := issue_service.DeleteIssue(ctx, ctx.Doer, ctx.Repo.GitRepo, issue); err != nil { + ctx.ServerError("DeleteIssue", err) + return + } + } + ctx.JSONOK() +} + // UpdateIssueStatus change issue's status func UpdateIssueStatus(ctx *context.Context) { issues := getActionIssues(ctx) @@ -2740,9 +2754,7 @@ func UpdateIssueStatus(ctx *context.Context) { } } } - ctx.JSON(http.StatusOK, map[string]interface{}{ - "ok": true, - }) + ctx.JSONOK() } // NewComment create a comment for issue diff --git a/routers/web/web.go b/routers/web/web.go index fae935a507..8ac01f1742 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1024,6 +1024,7 @@ func registerRoutes(m *web.Route) { m.Post("/request_review", reqRepoIssuesOrPullsReader, repo.UpdatePullReviewRequest) m.Post("/dismiss_review", reqRepoAdmin, web.Bind(forms.DismissReviewForm{}), repo.DismissReview) m.Post("/status", reqRepoIssuesOrPullsWriter, repo.UpdateIssueStatus) + m.Post("/delete", reqRepoAdmin, repo.BatchDeleteIssues) m.Post("/resolve_conversation", reqRepoIssuesOrPullsReader, repo.UpdateResolveConversation) m.Post("/attachments", repo.UploadIssueAttachment) m.Post("/attachments/remove", repo.DeleteAttachment) |