Fix: Discussion + Note Creation Bugs (#151)

This MR is an attempt to resolve some of the issues this plugin is experiencing with Gitlab's API surrounding comments, in particular the specifics around when to send the "old line" versus "new line" and the file hashes.

This is a PATCH release.
This commit is contained in:
Harrison (Harry) Cramer
2024-01-13 10:52:45 -05:00
committed by GitHub
parent ed3a90cf00
commit 519791c81c
3 changed files with 41 additions and 6 deletions

View File

@@ -192,7 +192,7 @@ M.parse_diagnostics_from_discussions = function(discussions)
return {}, {}, string.format("Unsupported line range type found for discussion %s", discussion.id)
end
else -- Diagnostics for single line discussions.
if first_note.position.new_line ~= nil then
if first_note.position.new_line ~= nil and first_note.position.old_line == nil then
local new_diagnostic = {
lnum = first_note.position.new_line - 1,
}
@@ -306,7 +306,7 @@ M.parse_signs_from_discussions = function(discussions)
local sign = vim.tbl_deep_extend("force", {
id = first_note.id,
}, base_sign)
if first_note.position.new_line ~= nil then
if first_note.position.new_line ~= nil and first_note.position.old_line == nil then
table.insert(new_signs, vim.tbl_deep_extend("force", { lnum = first_note.position.new_line }, sign))
end
if first_note.position.old_line ~= nil then