From 339669edfcc55bf0e53a9b0863b67054ab349ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20F=2E=20Bortl=C3=ADk?= Date: Thu, 21 Nov 2024 10:50:03 +0100 Subject: [PATCH] feat: automatically update MR status in Summary --- lua/gitlab/actions/approvals.lua | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lua/gitlab/actions/approvals.lua b/lua/gitlab/actions/approvals.lua index 8ca7669c..12b3e09d 100644 --- a/lua/gitlab/actions/approvals.lua +++ b/lua/gitlab/actions/approvals.lua @@ -1,13 +1,26 @@ local job = require("gitlab.job") +local state = require("gitlab.state") +local u = require("gitlab.utils") local M = {} +local refresh_status_state = function(data) + u.notify(data.message, vim.log.levels.INFO) + state.load_new_state("info", function() + require("gitlab.actions.summary").update_summary_details() + end) +end + M.approve = function() - job.run_job("/mr/approve", "POST") + job.run_job("/mr/approve", "POST", nil, function(data) + refresh_status_state(data) + end) end M.revoke = function() - job.run_job("/mr/revoke", "POST") + job.run_job("/mr/revoke", "POST", nil, function(data) + refresh_status_state(data) + end) end return M