Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #438 from maxice8/assign-myself
Browse files Browse the repository at this point in the history
feat(pkg/api/user): if given user is @me, translate to current user
  • Loading branch information
profclems committed Dec 28, 2020
2 parents 83019fe + 38a199e commit 98f77aa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/api/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ var UserByName = func(client *gitlab.Client, name string) (*gitlab.User, error)
opts.PerPage = DefaultListLimit
}

// Handle special case of '@me' which maps to the currently authenticated user
if name == "@me" {
return CurrentUser(client)
}

users, _, err := client.Users.ListUsers(opts)
if err != nil {
return nil, err
Expand Down

0 comments on commit 98f77aa

Please sign in to comment.