diff options
Diffstat (limited to 'modules/repository/commits.go')
-rw-r--r-- | modules/repository/commits.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/repository/commits.go b/modules/repository/commits.go index a545ce952b..8e727c95d0 100644 --- a/modules/repository/commits.go +++ b/modules/repository/commits.go @@ -9,8 +9,8 @@ import ( "net/url" "time" - "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/avatars" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" api "code.gitea.io/gitea/modules/structs" @@ -35,14 +35,14 @@ type PushCommits struct { Len int avatars map[string]string - emailUsers map[string]*models.User + emailUsers map[string]*user_model.User } // NewPushCommits creates a new PushCommits object. func NewPushCommits() *PushCommits { return &PushCommits{ avatars: make(map[string]string), - emailUsers: make(map[string]*models.User), + emailUsers: make(map[string]*user_model.User), } } @@ -52,7 +52,7 @@ func (pc *PushCommits) toAPIPayloadCommit(repoPath, repoLink string, commit *Pus authorUsername := "" author, ok := pc.emailUsers[commit.AuthorEmail] if !ok { - author, err = models.GetUserByEmail(commit.AuthorEmail) + author, err = user_model.GetUserByEmail(commit.AuthorEmail) if err == nil { authorUsername = author.Name pc.emailUsers[commit.AuthorEmail] = author @@ -64,7 +64,7 @@ func (pc *PushCommits) toAPIPayloadCommit(repoPath, repoLink string, commit *Pus committerUsername := "" committer, ok := pc.emailUsers[commit.CommitterEmail] if !ok { - committer, err = models.GetUserByEmail(commit.CommitterEmail) + committer, err = user_model.GetUserByEmail(commit.CommitterEmail) if err == nil { // TODO: check errors other than email not found. committerUsername = committer.Name @@ -107,7 +107,7 @@ func (pc *PushCommits) ToAPIPayloadCommits(repoPath, repoLink string) ([]*api.Pa var headCommit *api.PayloadCommit if pc.emailUsers == nil { - pc.emailUsers = make(map[string]*models.User) + pc.emailUsers = make(map[string]*user_model.User) } for i, commit := range pc.Commits { apiCommit, err := pc.toAPIPayloadCommit(repoPath, repoLink, commit) @@ -146,10 +146,10 @@ func (pc *PushCommits) AvatarLink(email string) string { u, ok := pc.emailUsers[email] if !ok { var err error - u, err = models.GetUserByEmail(email) + u, err = user_model.GetUserByEmail(email) if err != nil { pc.avatars[email] = avatars.GenerateEmailAvatarFastLink(email, size) - if !models.IsErrUserNotExist(err) { + if !user_model.IsErrUserNotExist(err) { log.Error("GetUserByEmail: %v", err) return "" } @@ -189,6 +189,6 @@ func GitToPushCommits(gitCommits []*git.Commit) *PushCommits { CompareURL: "", Len: len(commits), avatars: make(map[string]string), - emailUsers: make(map[string]*models.User), + emailUsers: make(map[string]*user_model.User), } } |