Move some issue methods as functions (#19255)
* Move some issue methods as functions * Fix bug
This commit is contained in:
parent
bd97736b9c
commit
74731c3a5a
19 changed files with 63 additions and 84 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue