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

feat(pkg/api/user): if given user is @me, translate to current user #438

Merged
merged 1 commit into from
Dec 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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