diff options
author | Joe Chen <jc@unknwon.io> | 2022-06-11 09:42:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-11 09:42:17 +0800 |
commit | f837ea6346ac720d586eda51ab89c5c71a1f3e65 (patch) | |
tree | 678b0bdccee80e65c399e8696cd209c9e902618d /internal/db/user.go | |
parent | 9776bdc9b8b441ebd73c100bfe2aa4e495c233ca (diff) |
db: use `context` and go-mockgen for `UsersStore` (#7042)
Diffstat (limited to 'internal/db/user.go')
-rw-r--r-- | internal/db/user.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/db/user.go b/internal/db/user.go index c6bee120..ebfbf082 100644 --- a/internal/db/user.go +++ b/internal/db/user.go @@ -942,7 +942,8 @@ func GetUserByID(id int64) (*User, error) { // GetAssigneeByID returns the user with read access of repository by given ID. func GetAssigneeByID(repo *Repository, userID int64) (*User, error) { - if !Perms.Authorize(context.TODO(), userID, repo.ID, AccessModeRead, + ctx := context.TODO() + if !Perms.Authorize(ctx, userID, repo.ID, AccessModeRead, AccessModeOptions{ OwnerID: repo.OwnerID, Private: repo.IsPrivate, @@ -950,7 +951,7 @@ func GetAssigneeByID(repo *Repository, userID int64) (*User, error) { ) { return nil, ErrUserNotExist{args: map[string]interface{}{"userID": userID}} } - return Users.GetByID(userID) + return Users.GetByID(ctx, userID) } // GetUserByName returns a user by given name. |