diff options
Diffstat (limited to 'models/repo_collaboration.go')
-rw-r--r-- | models/repo_collaboration.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/models/repo_collaboration.go b/models/repo_collaboration.go index 6502d7959c..11d1a0e1d0 100644 --- a/models/repo_collaboration.go +++ b/models/repo_collaboration.go @@ -10,6 +10,7 @@ import ( "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/log" "code.gitea.io/gitea/modules/timeutil" @@ -30,7 +31,7 @@ func init() { db.RegisterModel(new(Collaboration)) } -func (repo *Repository) addCollaborator(e db.Engine, u *User) error { +func (repo *Repository) addCollaborator(e db.Engine, u *user_model.User) error { collaboration := &Collaboration{ RepoID: repo.ID, UserID: u.ID, @@ -52,7 +53,7 @@ func (repo *Repository) addCollaborator(e db.Engine, u *User) error { } // AddCollaborator adds new collaboration to a repository with default access mode. -func (repo *Repository) AddCollaborator(u *User) error { +func (repo *Repository) AddCollaborator(u *user_model.User) error { ctx, committer, err := db.TxContext() if err != nil { return err @@ -80,7 +81,7 @@ func (repo *Repository) getCollaborations(e db.Engine, listOptions db.ListOption // Collaborator represents a user with collaboration details. type Collaborator struct { - *User + *user_model.User Collaboration *Collaboration } @@ -92,11 +93,11 @@ func (repo *Repository) getCollaborators(e db.Engine, listOptions db.ListOptions collaborators := make([]*Collaborator, 0, len(collaborations)) for _, c := range collaborations { - user, err := getUserByID(e, c.UserID) + user, err := user_model.GetUserByIDEngine(e, c.UserID) if err != nil { - if IsErrUserNotExist(err) { + if user_model.IsErrUserNotExist(err) { log.Warn("Inconsistent DB: User: %d is listed as collaborator of %-v but does not exist", c.UserID, repo) - user = NewGhostUser() + user = user_model.NewGhostUser() } else { return nil, err } @@ -227,7 +228,7 @@ func (repo *Repository) DeleteCollaboration(uid int64) (err error) { } func (repo *Repository) reconsiderIssueAssignees(e db.Engine, uid int64) error { - user, err := getUserByID(e, uid) + user, err := user_model.GetUserByIDEngine(e, uid) if err != nil { return err } |