diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-03-31 17:20:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 17:20:39 +0800 |
commit | d4f84f1c937e24e71aa5f05c58d440cde741450f (patch) | |
tree | 18571ad08fabe6d1090ea4d2674beab3b1c00a6e /models/issue.go | |
parent | 43332a483f7838df66e0209eb9c15d4aba3d5874 (diff) | |
download | gitea-d4f84f1c937e24e71aa5f05c58d440cde741450f.tar.gz gitea-d4f84f1c937e24e71aa5f05c58d440cde741450f.zip |
Move reaction to models/issues/ (#19264)
* Move reaction to models/issues/
* Fix test
* move the function
* improve code
* Update models/issues/reaction.go
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'models/issue.go')
-rw-r--r-- | models/issue.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/models/issue.go b/models/issue.go index 99688f2ec9..cf5e4fd8b6 100644 --- a/models/issue.go +++ b/models/issue.go @@ -72,7 +72,7 @@ type Issue struct { Attachments []*repo_model.Attachment `xorm:"-"` Comments []*Comment `xorm:"-"` - Reactions ReactionList `xorm:"-"` + Reactions issues.ReactionList `xorm:"-"` TotalTrackedTime int64 `xorm:"-"` Assignees []*user_model.User `xorm:"-"` ForeignReference *foreignreference.ForeignReference `xorm:"-"` @@ -244,8 +244,7 @@ func (issue *Issue) loadReactions(ctx context.Context) (err error) { if issue.Reactions != nil { return nil } - e := db.GetEngine(ctx) - reactions, _, err := findReactions(e, FindReactionsOptions{ + reactions, _, err := issues.FindReactions(ctx, issues.FindReactionsOptions{ IssueID: issue.ID, }) if err != nil { @@ -255,7 +254,7 @@ func (issue *Issue) loadReactions(ctx context.Context) (err error) { return err } // Load reaction user data - if _, err := ReactionList(reactions).loadUsers(e, issue.Repo); err != nil { + if _, err := issues.ReactionList(reactions).LoadUsers(ctx, issue.Repo); err != nil { return err } @@ -2111,7 +2110,7 @@ func deleteIssue(ctx context.Context, issue *Issue) error { &IssueAssignees{}, &IssueUser{}, &Notification{}, - &Reaction{}, + &issues.Reaction{}, &IssueWatch{}, &Stopwatch{}, &TrackedTime{}, @@ -2429,7 +2428,7 @@ func deleteIssuesByRepoID(sess db.Engine, repoID int64) (attachmentPaths []strin } if _, err = sess.In("issue_id", deleteCond). - Delete(&Reaction{}); err != nil { + Delete(&issues.Reaction{}); err != nil { return } |