summaryrefslogtreecommitdiffstats
path: root/services/issue
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 /services/issue
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 'services/issue')
-rw-r--r--services/issue/assignee.go2
-rw-r--r--services/issue/content.go2
-rw-r--r--services/issue/issue.go6
-rw-r--r--services/issue/label.go4
-rw-r--r--services/issue/status.go2
5 files changed, 8 insertions, 8 deletions
diff --git a/services/issue/assignee.go b/services/issue/assignee.go
index 86d653dfa6..479c9cbb13 100644
--- a/services/issue/assignee.go
+++ b/services/issue/assignee.go
@@ -42,7 +42,7 @@ func DeleteNotPassedAssignee(issue *models.Issue, doer *user_model.User, assigne
// ToggleAssignee changes a user between assigned and not assigned for this issue, and make issue comment for it.
func ToggleAssignee(issue *models.Issue, doer *user_model.User, assigneeID int64) (removed bool, comment *models.Comment, err error) {
- removed, comment, err = issue.ToggleAssignee(doer, assigneeID)
+ removed, comment, err = models.ToggleIssueAssignee(issue, doer, assigneeID)
if err != nil {
return
}
diff --git a/services/issue/content.go b/services/issue/content.go
index 6d7883090b..a60878479b 100644
--- a/services/issue/content.go
+++ b/services/issue/content.go
@@ -14,7 +14,7 @@ import (
func ChangeContent(issue *models.Issue, doer *user_model.User, content string) (err error) {
oldContent := issue.Content
- if err := issue.ChangeContent(doer, content); err != nil {
+ if err := models.ChangeIssueContent(issue, doer, content); err != nil {
return err
}
diff --git a/services/issue/issue.go b/services/issue/issue.go
index 6e5e4bfd37..6bc3959979 100644
--- a/services/issue/issue.go
+++ b/services/issue/issue.go
@@ -28,7 +28,7 @@ func NewIssue(repo *repo_model.Repository, issue *models.Issue, labelIDs []int64
}
}
- mentions, err := issue.FindAndUpdateIssueMentions(db.DefaultContext, issue.Poster, issue.Content)
+ mentions, err := models.FindAndUpdateIssueMentions(db.DefaultContext, issue, issue.Poster, issue.Content)
if err != nil {
return err
}
@@ -49,7 +49,7 @@ func ChangeTitle(issue *models.Issue, doer *user_model.User, title string) (err
oldTitle := issue.Title
issue.Title = title
- if err = issue.ChangeTitle(doer, oldTitle); err != nil {
+ if err = models.ChangeIssueTitle(issue, doer, oldTitle); err != nil {
return
}
@@ -63,7 +63,7 @@ func ChangeIssueRef(issue *models.Issue, doer *user_model.User, ref string) erro
oldRef := issue.Ref
issue.Ref = ref
- if err := issue.ChangeRef(doer, oldRef); err != nil {
+ if err := models.ChangeIssueRef(issue, doer, oldRef); err != nil {
return err
}
diff --git a/services/issue/label.go b/services/issue/label.go
index 96df7ed345..9971be326c 100644
--- a/services/issue/label.go
+++ b/services/issue/label.go
@@ -12,7 +12,7 @@ import (
// ClearLabels clears all of an issue's labels
func ClearLabels(issue *models.Issue, doer *user_model.User) (err error) {
- if err = issue.ClearLabels(doer); err != nil {
+ if err = models.ClearIssueLabels(issue, doer); err != nil {
return
}
@@ -73,7 +73,7 @@ func ReplaceLabels(issue *models.Issue, doer *user_model.User, labels []*models.
return err
}
- if err := issue.ReplaceLabels(labels, doer); err != nil {
+ if err := models.ReplaceIssueLabels(issue, labels, doer); err != nil {
return err
}
diff --git a/services/issue/status.go b/services/issue/status.go
index 64fbccd26a..1af4508b09 100644
--- a/services/issue/status.go
+++ b/services/issue/status.go
@@ -14,7 +14,7 @@ import (
// ChangeStatus changes issue status to open or closed.
func ChangeStatus(issue *models.Issue, doer *user_model.User, closed bool) error {
- comment, err := issue.ChangeStatus(doer, closed)
+ comment, err := models.ChangeIssueStatus(issue, doer, closed)
if err != nil {
if models.IsErrDependenciesLeft(err) && closed {
if err := models.FinishIssueStopwatchIfPossible(db.DefaultContext, doer, issue); err != nil {