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 /modules/convert/pull_review.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 'modules/convert/pull_review.go')
-rw-r--r-- | modules/convert/pull_review.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/modules/convert/pull_review.go b/modules/convert/pull_review.go index b461b27b5a..b99d7bead6 100644 --- a/modules/convert/pull_review.go +++ b/modules/convert/pull_review.go @@ -8,16 +8,17 @@ import ( "strings" "code.gitea.io/gitea/models" + user_model "code.gitea.io/gitea/models/user" api "code.gitea.io/gitea/modules/structs" ) // ToPullReview convert a review to api format -func ToPullReview(r *models.Review, doer *models.User) (*api.PullReview, error) { +func ToPullReview(r *models.Review, doer *user_model.User) (*api.PullReview, error) { if err := r.LoadAttributes(); err != nil { - if !models.IsErrUserNotExist(err) { + if !user_model.IsErrUserNotExist(err) { return nil, err } - r.Reviewer = models.NewGhostUser() + r.Reviewer = user_model.NewGhostUser() } result := &api.PullReview{ @@ -53,7 +54,7 @@ func ToPullReview(r *models.Review, doer *models.User) (*api.PullReview, error) } // ToPullReviewList convert a list of review to it's api format -func ToPullReviewList(rl []*models.Review, doer *models.User) ([]*api.PullReview, error) { +func ToPullReviewList(rl []*models.Review, doer *user_model.User) ([]*api.PullReview, error) { result := make([]*api.PullReview, 0, len(rl)) for i := range rl { // show pending reviews only for the user who created them @@ -70,12 +71,12 @@ func ToPullReviewList(rl []*models.Review, doer *models.User) ([]*api.PullReview } // ToPullReviewCommentList convert the CodeComments of an review to it's api format -func ToPullReviewCommentList(review *models.Review, doer *models.User) ([]*api.PullReviewComment, error) { +func ToPullReviewCommentList(review *models.Review, doer *user_model.User) ([]*api.PullReviewComment, error) { if err := review.LoadAttributes(); err != nil { - if !models.IsErrUserNotExist(err) { + if !user_model.IsErrUserNotExist(err) { return nil, err } - review.Reviewer = models.NewGhostUser() + review.Reviewer = user_model.NewGhostUser() } apiComments := make([]*api.PullReviewComment, 0, len(review.CodeComments)) |