1
0
Fork 0
forked from forgejo/forgejo

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>
This commit is contained in:
Lunny Xiao 2022-03-31 17:20:39 +08:00 committed by GitHub
parent 43332a483f
commit d4f84f1c93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 280 additions and 274 deletions

View file

@ -10,6 +10,7 @@ import (
"code.gitea.io/gitea/models/db"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/container"
)
// CommentList defines a list of comments
@ -22,7 +23,7 @@ func (comments CommentList) getPosterIDs() []int64 {
posterIDs[comment.PosterID] = struct{}{}
}
}
return keysInt64(posterIDs)
return container.KeysInt64(posterIDs)
}
func (comments CommentList) loadPosters(e db.Engine) error {
@ -75,7 +76,7 @@ func (comments CommentList) getLabelIDs() []int64 {
ids[comment.LabelID] = struct{}{}
}
}
return keysInt64(ids)
return container.KeysInt64(ids)
}
func (comments CommentList) loadLabels(e db.Engine) error {
@ -125,7 +126,7 @@ func (comments CommentList) getMilestoneIDs() []int64 {
ids[comment.MilestoneID] = struct{}{}
}
}
return keysInt64(ids)
return container.KeysInt64(ids)
}
func (comments CommentList) loadMilestones(e db.Engine) error {
@ -168,7 +169,7 @@ func (comments CommentList) getOldMilestoneIDs() []int64 {
ids[comment.OldMilestoneID] = struct{}{}
}
}
return keysInt64(ids)
return container.KeysInt64(ids)
}
func (comments CommentList) loadOldMilestones(e db.Engine) error {
@ -211,7 +212,7 @@ func (comments CommentList) getAssigneeIDs() []int64 {
ids[comment.AssigneeID] = struct{}{}
}
}
return keysInt64(ids)
return container.KeysInt64(ids)
}
func (comments CommentList) loadAssignees(e db.Engine) error {
@ -267,7 +268,7 @@ func (comments CommentList) getIssueIDs() []int64 {
ids[comment.IssueID] = struct{}{}
}
}
return keysInt64(ids)
return container.KeysInt64(ids)
}
// Issues returns all the issues of comments
@ -342,7 +343,7 @@ func (comments CommentList) getDependentIssueIDs() []int64 {
ids[comment.DependentIssueID] = struct{}{}
}
}
return keysInt64(ids)
return container.KeysInt64(ids)
}
func (comments CommentList) loadDependentIssues(ctx context.Context) error {
@ -444,7 +445,7 @@ func (comments CommentList) getReviewIDs() []int64 {
ids[comment.ReviewID] = struct{}{}
}
}
return keysInt64(ids)
return container.KeysInt64(ids)
}
func (comments CommentList) loadReviews(e db.Engine) error {