Skip to content

Commit

Permalink
Merge pull request #661 from wd60622/add-name
Browse files Browse the repository at this point in the history
Add name in user queries
  • Loading branch information
Alvaro Muñoz authored Nov 4, 2024
2 parents 87c1a07 + fa8b920 commit 1f3115b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lua/octo/gh/graphql.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2703,6 +2703,7 @@ query($endCursor: String) {
nodes {
id
login
name
}
}
}
Expand All @@ -2721,6 +2722,7 @@ query($endCursor: String) {
nodes {
id
login
name
}
}
}
Expand Down
16 changes: 14 additions & 2 deletions lua/octo/pickers/telescope/entry_maker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,25 @@ function M.gen_from_team()
end

function M.gen_from_user()
local function create_name(user, parens)
if not user.name or user.name == vim.NIL then
return user.login
end

if parens then
return user.login .. " (" .. user.name .. ")"
end

return user.login .. user.name
end

local make_display = function(entry)
if not entry then
return nil
end

local columns = {
{ entry.user.login },
{ create_name(entry.user, true) },
}

local displayer = entry_display.create {
Expand All @@ -438,7 +450,7 @@ function M.gen_from_user()

return {
value = user.id,
ordinal = user.login,
ordinal = create_name(user, false),
display = make_display,
user = user,
}
Expand Down
2 changes: 2 additions & 0 deletions lua/octo/pickers/telescope/provider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ local function get_user_requester()
users[user.login] = {
id = user.id,
login = user.login,
name = user.name,
}
end
elseif user.teams and user.teams.totalCount > 0 then
Expand Down Expand Up @@ -869,6 +870,7 @@ local function get_users(query_name, node_name)
table.insert(users, {
id = user.id,
login = user.login,
name = user.name,
})
end
end
Expand Down

0 comments on commit 1f3115b

Please sign in to comment.