summaryrefslogtreecommitdiffstats
path: root/modules/context/context.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-24 17:49:20 +0800
committerGitHub <noreply@github.com>2021-11-24 17:49:20 +0800
commita666829a37be6f9fd98f9e7dd1767c420f7f3b32 (patch)
tree9ab1434b759a8a2cb275a83149903a823851e309 /modules/context/context.go
parent4e7ca946da2a2642a62f114825129bf5d7ed9196 (diff)
downloadgitea-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/context/context.go')
-rw-r--r--modules/context/context.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/context/context.go b/modules/context/context.go
index 6fc4c7261a..5a37f8b0bf 100644
--- a/modules/context/context.go
+++ b/modules/context/context.go
@@ -20,8 +20,8 @@ import (
"strings"
"time"
- "code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/unit"
+ user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/base"
mc "code.gitea.io/gitea/modules/cache"
"code.gitea.io/gitea/modules/json"
@@ -62,7 +62,7 @@ type Context struct {
Link string // current request URL
EscapedLink string
- User *models.User
+ User *user_model.User
IsSigned bool
IsBasicAuth bool
@@ -123,7 +123,7 @@ func (ctx *Context) IsUserRepoReaderAny() bool {
// RedirectToUser redirect to a differently-named user
func RedirectToUser(ctx *Context, userName string, redirectUserID int64) {
- user, err := models.GetUserByID(redirectUserID)
+ user, err := user_model.GetUserByID(redirectUserID)
if err != nil {
ctx.ServerError("GetUserByID", err)
return
@@ -560,7 +560,7 @@ func GetContext(req *http.Request) *Context {
}
// GetContextUser returns context user
-func GetContextUser(req *http.Request) *models.User {
+func GetContextUser(req *http.Request) *user_model.User {
if apiContext, ok := req.Context().Value(apiContextKey).(*APIContext); ok {
return apiContext.User
}