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/feed | |
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/feed')
-rw-r--r-- | routers/web/feed/profile.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/routers/web/feed/profile.go b/routers/web/feed/profile.go index 8bd0cb7c29..1a7f4ad24b 100644 --- a/routers/web/feed/profile.go +++ b/routers/web/feed/profile.go @@ -9,6 +9,7 @@ import ( "time" "code.gitea.io/gitea/models" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/context" "github.com/gorilla/feeds" @@ -22,7 +23,7 @@ func RetrieveFeeds(ctx *context.Context, options models.GetFeedsOptions) []*mode return nil } - userCache := map[int64]*models.User{options.RequestedUser.ID: options.RequestedUser} + userCache := map[int64]*user_model.User{options.RequestedUser.ID: options.RequestedUser} if ctx.User != nil { userCache[ctx.User.ID] = ctx.User } @@ -35,9 +36,9 @@ func RetrieveFeeds(ctx *context.Context, options models.GetFeedsOptions) []*mode for _, act := range actions { repoOwner, ok := userCache[act.Repo.OwnerID] if !ok { - repoOwner, err = models.GetUserByID(act.Repo.OwnerID) + repoOwner, err = user_model.GetUserByID(act.Repo.OwnerID) if err != nil { - if models.IsErrUserNotExist(err) { + if user_model.IsErrUserNotExist(err) { continue } ctx.ServerError("GetUserByID", err) @@ -51,7 +52,7 @@ func RetrieveFeeds(ctx *context.Context, options models.GetFeedsOptions) []*mode } // ShowUserFeed show user activity as RSS / Atom feed -func ShowUserFeed(ctx *context.Context, ctxUser *models.User, formatType string) { +func ShowUserFeed(ctx *context.Context, ctxUser *user_model.User, formatType string) { actions := RetrieveFeeds(ctx, models.GetFeedsOptions{ RequestedUser: ctxUser, Actor: ctx.User, |