summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-03-29 22:57:33 +0800
committerGitHub <noreply@github.com>2022-03-29 16:57:33 +0200
commit74731c3a5aea71c81e4ca75bde96154f3adf3cfa (patch)
tree64b01935ab9912de71318eac447721e41b200135 /routers
parentbd97736b9c7a16023bc9abf17be6157284f655b1 (diff)
downloadgitea-74731c3a5aea71c81e4ca75bde96154f3adf3cfa.tar.gz
gitea-74731c3a5aea71c81e4ca75bde96154f3adf3cfa.zip
Move some issue methods as functions (#19255)
* Move some issue methods as functions * Fix bug
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/pull.go2
-rw-r--r--routers/web/repo/issue.go2
-rw-r--r--routers/web/repo/issue_label.go2
3 files changed, 3 insertions, 3 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index ba3c42d9d7..1618c74fbc 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -560,7 +560,7 @@ func EditPullRequest(ctx *context.APIContext) {
labels = append(labels, orgLabels...)
}
- if err = issue.ReplaceLabels(labels, ctx.Doer); err != nil {
+ if err = models.ReplaceIssueLabels(issue, labels, ctx.Doer); err != nil {
ctx.Error(http.StatusInternalServerError, "ReplaceLabelsError", err)
return
}
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 5af91c8e5f..c50e773e99 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -2595,7 +2595,7 @@ func updateAttachments(item interface{}, files []string) error {
if len(files) > 0 {
switch content := item.(type) {
case *models.Issue:
- err = content.UpdateAttachments(files)
+ err = models.UpdateIssueAttachments(content.ID, files)
case *models.Comment:
err = content.UpdateAttachments(files)
default:
diff --git a/routers/web/repo/issue_label.go b/routers/web/repo/issue_label.go
index 289e870bb1..887bbc115f 100644
--- a/routers/web/repo/issue_label.go
+++ b/routers/web/repo/issue_label.go
@@ -191,7 +191,7 @@ func UpdateIssueLabel(ctx *context.Context) {
// detach if any issues already have label, otherwise attach
action = "attach"
for _, issue := range issues {
- if issue.HasLabel(label.ID) {
+ if models.HasIssueLabel(issue.ID, label.ID) {
action = "detach"
break
}