Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/codereview/mr/detail.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ local function render_thread(result, disc, width, reply_key, resolve_key, is_las
-- Status dot + label: "● Unresolved" or "○ Resolved"
local status_dot = ""
local status_label = ""
if first_note.resolvable ~= nil or disc.resolved ~= nil then
if disc.resolvable then
status_dot = resolved and "○" or "●"
status_label = resolved and " Resolved" or " Unresolved"
end
Expand Down
1 change: 1 addition & 0 deletions lua/codereview/providers/github.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ function M.normalize_graphql_threads(thread_nodes)
table.insert(discussions, {
id = tostring(comments[1].databaseId),
node_id = thread.id,
resolvable = true,
resolved = thread.isResolved or false,
notes = notes,
})
Expand Down
14 changes: 12 additions & 2 deletions lua/codereview/providers/gitlab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,20 @@ end
--- Map a GitLab discussion raw object to a normalized discussion.
function M.normalize_discussion(raw)
local notes = {}
local resolvable = raw.resolvable or false
local resolved = raw.resolved or true
for _, n in ipairs(raw.notes or {}) do
table.insert(notes, normalize_note(n))
local note = normalize_note(n)
table.insert(notes, note)

if note.resolvable then
resolvable = true
if not note.resolved then
resolved = false
end
end
end
return { id = raw.id, resolved = raw.resolved or false, notes = notes }
return { id = raw.id, resolved = resolved, resolvable = resolvable, notes = notes }
end

--- Normalize a GitLab file diff entry.
Expand Down
65 changes: 65 additions & 0 deletions tests/codereview/mr/detail_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ describe("mr.detail", function()
local discussions = {
{
id = "abc",
resolvable = true,
resolved = false,
notes = {
{
Expand All @@ -283,10 +284,69 @@ describe("mr.detail", function()
}
local result = detail.build_activity_lines(discussions)
local joined = table.concat(result.lines, "\n")
print(joined)
assert.truthy(joined:find("Unresolved"))
assert.truthy(joined:find("●"))
end)

it("count resolved/unresolved status for resolvables", function()
local discussions = {
{
id = "abc",
resolvable = true,
resolved = false,
notes = {
{
id = 1,
body = "Bug here",
author = "alice",
created_at = "2026-02-20T10:00:00Z",
system = false,
resolvable = true,
resolved = false,
},
},
},
{
id = "def",
resolvable = true,
resolved = true,
notes = {
{
id = 1,
body = "Bug here resolved",
author = "alice",
created_at = "2026-02-20T10:00:00Z",
system = false,
resolvable = true,
resolved = true,
},
},
},
{
id = "ghi",
resolvable = false,
resolved = true,
notes = {
{
id = 1,
body = "not resolvable here",
author = "alice",
created_at = "2026-02-20T10:00:00Z",
system = false,
resolvable = false,
resolved = true,
},
},
},
}
local result = detail.build_activity_lines(discussions)
local joined = table.concat(result.lines, "\n")
assert.truthy(joined:find("1 unresolved"))
assert.truthy(joined:find("○ Resolved"))
assert.truthy(joined:find("● Unresolved"))
end)

it("maps thread rows to discussions in row_map", function()
local disc = {
id = "abc",
Expand Down Expand Up @@ -423,6 +483,8 @@ describe("mr.detail", function()
local discussions = {
{
id = "s1",
resolvable = false,
resolved = false,
notes = {
{
id = 1,
Expand Down Expand Up @@ -450,6 +512,7 @@ describe("mr.detail", function()
local discussions = {
{
id = "d1",
resolvable = true,
resolved = false,
notes = {
{
Expand Down Expand Up @@ -478,6 +541,7 @@ describe("mr.detail", function()
local discussions = {
{
id = "d1",
resolvable = true,
resolved = false,
notes = {
{
Expand Down Expand Up @@ -507,6 +571,7 @@ describe("mr.detail", function()
local discussions = {
{
id = "d1",
resolvable = true,
resolved = false,
notes = {
{
Expand Down
Loading