mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(gh): properly handly pending requests
This commit is contained in:
parent
cd0d6fe864
commit
7a15e16d01
4 changed files with 5 additions and 5 deletions
|
|
@ -464,6 +464,7 @@ function M.comments(item, cb)
|
||||||
state
|
state
|
||||||
commit { oid }
|
commit { oid }
|
||||||
submittedAt
|
submittedAt
|
||||||
|
createdAt
|
||||||
reactionGroups {
|
reactionGroups {
|
||||||
content
|
content
|
||||||
users { totalCount }
|
users { totalCount }
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,6 @@ function M:update(data, fields)
|
||||||
vim.tbl_map(fix, item.comments or {})
|
vim.tbl_map(fix, item.comments or {})
|
||||||
for _, review in ipairs(item.reviews or {}) do
|
for _, review in ipairs(item.reviews or {}) do
|
||||||
fix(review)
|
fix(review)
|
||||||
review.created = review.submitted
|
|
||||||
vim.tbl_map(fix, review.comments or {})
|
vim.tbl_map(fix, review.comments or {})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -302,13 +302,12 @@ function M.render(buf, item, opts)
|
||||||
for _, thread in ipairs(threads) do
|
for _, thread in ipairs(threads) do
|
||||||
local c = #lines
|
local c = #lines
|
||||||
|
|
||||||
if thread.submitted then
|
ctx.is_review = thread.state ~= nil
|
||||||
|
if ctx.is_review then
|
||||||
---@cast thread snacks.gh.Review
|
---@cast thread snacks.gh.Review
|
||||||
ctx.is_review = true
|
|
||||||
vim.list_extend(lines, M.review(thread, ctx))
|
vim.list_extend(lines, M.review(thread, ctx))
|
||||||
else
|
else
|
||||||
---@cast thread snacks.gh.Comment
|
---@cast thread snacks.gh.Comment
|
||||||
ctx.is_review = false
|
|
||||||
vim.list_extend(lines, M.comment(thread, ctx))
|
vim.list_extend(lines, M.comment(thread, ctx))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@
|
||||||
---@field author snacks.gh.User
|
---@field author snacks.gh.User
|
||||||
---@field authorAssociation string
|
---@field authorAssociation string
|
||||||
---@field body string
|
---@field body string
|
||||||
|
---@field createdAt string
|
||||||
---@field submittedAt string
|
---@field submittedAt string
|
||||||
---@field submitted number
|
---@field submitted number
|
||||||
---@field created number
|
---@field created number
|
||||||
|
|
@ -108,7 +109,7 @@
|
||||||
---@field commit? {oid: string}
|
---@field commit? {oid: string}
|
||||||
---@field comments? snacks.gh.Comment[]
|
---@field comments? snacks.gh.Comment[]
|
||||||
|
|
||||||
---@alias snacks.gh.Thread snacks.gh.Comment|snacks.gh.Review|{created: number}
|
---@alias snacks.gh.Thread snacks.gh.Comment|snacks.gh.Review
|
||||||
|
|
||||||
---@class snacks.gh.Item
|
---@class snacks.gh.Item
|
||||||
---@field number number
|
---@field number number
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue