diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-24 17:49:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 17:49:20 +0800 |
commit | a666829a37be6f9fd98f9e7dd1767c420f7f3b32 (patch) | |
tree | 9ab1434b759a8a2cb275a83149903a823851e309 /models/issue_label.go | |
parent | 4e7ca946da2a2642a62f114825129bf5d7ed9196 (diff) | |
download | gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.tar.gz gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.zip |
Move user related model into models/user (#17781)
* Move user related model into models/user
* Fix lint for windows
* Fix windows lint
* Fix windows lint
* Move some tests in models
* Merge
Diffstat (limited to 'models/issue_label.go')
-rw-r--r-- | models/issue_label.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/models/issue_label.go b/models/issue_label.go index 2858b12dde..9b36d8dfdf 100644 --- a/models/issue_label.go +++ b/models/issue_label.go @@ -15,6 +15,7 @@ import ( "strings" "code.gitea.io/gitea/models/db" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/timeutil" "xorm.io/builder" @@ -665,7 +666,7 @@ func HasIssueLabel(issueID, labelID int64) bool { // newIssueLabel this function creates a new label it does not check if the label is valid for the issue // YOU MUST CHECK THIS BEFORE THIS FUNCTION -func newIssueLabel(ctx context.Context, issue *Issue, label *Label, doer *User) (err error) { +func newIssueLabel(ctx context.Context, issue *Issue, label *Label, doer *user_model.User) (err error) { e := db.GetEngine(ctx) if _, err = e.Insert(&IssueLabel{ IssueID: issue.ID, @@ -694,7 +695,7 @@ func newIssueLabel(ctx context.Context, issue *Issue, label *Label, doer *User) } // NewIssueLabel creates a new issue-label relation. -func NewIssueLabel(issue *Issue, label *Label, doer *User) (err error) { +func NewIssueLabel(issue *Issue, label *Label, doer *user_model.User) (err error) { if HasIssueLabel(issue.ID, label.ID) { return nil } @@ -728,7 +729,7 @@ func NewIssueLabel(issue *Issue, label *Label, doer *User) (err error) { } // newIssueLabels add labels to an issue. It will check if the labels are valid for the issue -func newIssueLabels(ctx context.Context, issue *Issue, labels []*Label, doer *User) (err error) { +func newIssueLabels(ctx context.Context, issue *Issue, labels []*Label, doer *user_model.User) (err error) { e := db.GetEngine(ctx) if err = issue.loadRepo(e); err != nil { return err @@ -749,7 +750,7 @@ func newIssueLabels(ctx context.Context, issue *Issue, labels []*Label, doer *Us } // NewIssueLabels creates a list of issue-label relations. -func NewIssueLabels(issue *Issue, labels []*Label, doer *User) (err error) { +func NewIssueLabels(issue *Issue, labels []*Label, doer *user_model.User) (err error) { ctx, committer, err := db.TxContext() if err != nil { return err @@ -768,7 +769,7 @@ func NewIssueLabels(issue *Issue, labels []*Label, doer *User) (err error) { return committer.Commit() } -func deleteIssueLabel(ctx context.Context, issue *Issue, label *Label, doer *User) (err error) { +func deleteIssueLabel(ctx context.Context, issue *Issue, label *Label, doer *user_model.User) (err error) { e := db.GetEngine(ctx) if count, err := e.Delete(&IssueLabel{ IssueID: issue.ID, @@ -798,7 +799,7 @@ func deleteIssueLabel(ctx context.Context, issue *Issue, label *Label, doer *Use } // DeleteIssueLabel deletes issue-label relation. -func DeleteIssueLabel(issue *Issue, label *Label, doer *User) (err error) { +func DeleteIssueLabel(issue *Issue, label *Label, doer *user_model.User) (err error) { ctx, committer, err := db.TxContext() if err != nil { return err |