aboutsummaryrefslogtreecommitdiffstats
path: root/services/agit
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 /services/agit
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 'services/agit')
-rw-r--r--services/agit/agit.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/services/agit/agit.go b/services/agit/agit.go
index f32ad371d5..beb21940b0 100644
--- a/services/agit/agit.go
+++ b/services/agit/agit.go
@@ -11,6 +11,7 @@ import (
"strings"
"code.gitea.io/gitea/models"
+ user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
@@ -124,7 +125,7 @@ func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []privat
description = opts.GitPushOptions["description"]
}
- pusher, err := models.GetUserByID(opts.UserID)
+ pusher, err := user_model.GetUserByID(opts.UserID)
if err != nil {
log.Error("Failed to get user. Error: %v", err)
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
@@ -232,7 +233,7 @@ func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []privat
}
pull_service.AddToTaskQueue(pr)
- pusher, err := models.GetUserByID(opts.UserID)
+ pusher, err := user_model.GetUserByID(opts.UserID)
if err != nil {
log.Error("Failed to get user. Error: %v", err)
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
@@ -268,7 +269,7 @@ func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []privat
}
// UserNameChanged hanle user name change for agit flow pull
-func UserNameChanged(user *models.User, newName string) error {
+func UserNameChanged(user *user_model.User, newName string) error {
pulls, err := models.GetAllUnmergedAgitPullRequestByPoster(user.ID)
if err != nil {
return err