Fix: Jumping to renamed files (#484)
Fix: Store reviewer data before creating comment popup (#476)
Fix: Make publishing drafts more robust (#483)
Fix: Swap file_name and old_file_name in reviewer data (#485)

---------

Co-authored-by: Jakub F. Bortlík <jakub.bortlik@proton.me>
This commit is contained in:
Harrison (Harry) Cramer
2025-04-14 17:51:53 -04:00
committed by GitHub
parent 9f898aa1a8
commit a260f648fe
7 changed files with 79 additions and 38 deletions

View File

@@ -4,7 +4,7 @@ local Job = require("plenary.job")
local u = require("gitlab.utils")
local M = {}
M.run_job = function(endpoint, method, body, callback)
M.run_job = function(endpoint, method, body, callback, on_error_callback)
local state = require("gitlab.state")
local args = { "-s", "-X", (method or "POST"), string.format("localhost:%s", state.settings.port) .. endpoint }
@@ -16,7 +16,8 @@ M.run_job = function(endpoint, method, body, callback)
-- This handler will handle all responses from the Go server. Anything with a successful
-- status will call the callback (if it is supplied for the job). Otherwise, it will print out the
-- success message or error message and details from the Go server.
-- success message or error message and details from the Go server and run the on_error_callback
-- (if supplied for the job).
local stderr = {}
Job:new({
command = "curl",
@@ -53,6 +54,9 @@ M.run_job = function(endpoint, method, body, callback)
-- Handle error case
local message = string.format("%s: %s", data.message, data.details)
u.notify(message, vim.log.levels.ERROR)
if on_error_callback then
on_error_callback(data)
end
end
end, 0)
end,