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 /routers/web/repo/release.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 'routers/web/repo/release.go')
-rw-r--r-- | routers/web/repo/release.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/routers/web/repo/release.go b/routers/web/repo/release.go index 3f12ee72bc..9bca4e6897 100644 --- a/routers/web/repo/release.go +++ b/routers/web/repo/release.go @@ -13,6 +13,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/unit" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log" @@ -132,7 +133,7 @@ func releasesOrTags(ctx *context.Context, isTagList bool) { // Temporary cache commits count of used branches to speed up. countCache := make(map[string]int64) - cacheUsers := make(map[int64]*models.User) + cacheUsers := make(map[int64]*user_model.User) if ctx.User != nil { cacheUsers[ctx.User.ID] = ctx.User } @@ -140,10 +141,10 @@ func releasesOrTags(ctx *context.Context, isTagList bool) { for _, r := range releases { if r.Publisher, ok = cacheUsers[r.PublisherID]; !ok { - r.Publisher, err = models.GetUserByID(r.PublisherID) + r.Publisher, err = user_model.GetUserByID(r.PublisherID) if err != nil { - if models.IsErrUserNotExist(err) { - r.Publisher = models.NewGhostUser() + if user_model.IsErrUserNotExist(err) { + r.Publisher = user_model.NewGhostUser() } else { ctx.ServerError("GetUserByID", err) return @@ -207,10 +208,10 @@ func SingleRelease(ctx *context.Context) { return } - release.Publisher, err = models.GetUserByID(release.PublisherID) + release.Publisher, err = user_model.GetUserByID(release.PublisherID) if err != nil { - if models.IsErrUserNotExist(err) { - release.Publisher = models.NewGhostUser() + if user_model.IsErrUserNotExist(err) { + release.Publisher = user_model.NewGhostUser() } else { ctx.ServerError("GetUserByID", err) return |