From 481cc1fbcc6af4010ef15c32e3905a8282093217 Mon Sep 17 00:00:00 2001 From: johnybx Date: Wed, 15 Nov 2023 08:40:59 +0100 Subject: [PATCH] remove toggle_comment_resolved option and related stuff --- README.md | 3 +-- lua/gitlab/actions/discussions.lua | 24 +----------------------- lua/gitlab/init.lua | 1 - lua/gitlab/state.lua | 3 +-- 4 files changed, 3 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 7939f716..6c184118 100644 --- a/README.md +++ b/README.md @@ -125,8 +125,7 @@ require("gitlab").setup({ delete_comment = "dd", -- Delete comment reply = "r", -- Reply to comment toggle_node = "t", -- Opens or closes the discussion - toggle_comment_resolved = "p", -- Toggles the resolved status of the single comment - toggle_discussion_resolved = "P" -- Toggles the resolved status of the whole discussion + toggle_discussion_resolved = "p" -- Toggles the resolved status of the whole discussion position = "left", -- "top", "right", "bottom" or "left" size = "20%", -- Size of split relative = "editor", -- Position of tree split relative to "editor" or "window" diff --git a/lua/gitlab/actions/discussions.lua b/lua/gitlab/actions/discussions.lua index f29a2162..329e701a 100644 --- a/lua/gitlab/actions/discussions.lua +++ b/lua/gitlab/actions/discussions.lua @@ -634,25 +634,6 @@ M.send_edits = function(discussion_id, note_id, unlinked) end end --- This function (settings.discussion_tree.toggle_comment_resolved) will toggle the resolved status of the current comment and send the change to the Go server -M.toggle_comment_resolved = function(tree) - local note = tree:get_node() - if not note or not note.resolvable then - return - end - - local body = { - discussion_id = note.id, - note_id = note.root_note_id, - resolved = not note.resolved, - } - - job.run_job("/comment", "PATCH", body, function(data) - u.notify(data.message, vim.log.levels.INFO) - M.redraw_resolved_status(tree, note, not note.resolved) - end) -end - -- This function (settings.discussion_tree.toggle_discussion_resolved) will toggle the resolved status of the current discussion and send the change to the Go server M.toggle_discussion_resolved = function(tree) local note = tree:get_node() @@ -820,14 +801,11 @@ M.set_tree_keymaps = function(tree, bufnr, unlinked) vim.keymap.set("n", state.settings.discussion_tree.delete_comment, function() M.delete_comment(tree, unlinked) end, { buffer = bufnr }) - vim.keymap.set("n", state.settings.discussion_tree.toggle_comment_resolved, function() - M.toggle_comment_resolved(tree) - end, { buffer = bufnr }) vim.keymap.set("n", state.settings.discussion_tree.toggle_discussion_resolved, function() M.toggle_discussion_resolved(tree) end, { buffer = bufnr }) vim.keymap.set("n", state.settings.discussion_tree.toggle_node, function() - M.toggle_node(tree, unlinked) + M.toggle_node(tree) end, { buffer = bufnr }) vim.keymap.set("n", state.settings.discussion_tree.reply, function() M.reply(tree) diff --git a/lua/gitlab/init.lua b/lua/gitlab/init.lua index 2e966688..f6f5078f 100644 --- a/lua/gitlab/init.lua +++ b/lua/gitlab/init.lua @@ -47,7 +47,6 @@ return { toggle_discussions = async.sequence({ info }, discussions.toggle), edit_comment = async.sequence({ info }, discussions.edit_comment), delete_comment = async.sequence({ info }, discussions.delete_comment), - toggle_comment_resolved = async.sequence({ info }, discussions.toggle_comment_resolved), toggle_discussion_resolved = async.sequence({ info }, discussions.toggle_discussion_resolved), reply = async.sequence({ info }, discussions.reply), -- Other functions 🤷 diff --git a/lua/gitlab/state.lua b/lua/gitlab/state.lua index ddc86554..faef9988 100644 --- a/lua/gitlab/state.lua +++ b/lua/gitlab/state.lua @@ -26,8 +26,7 @@ M.settings = { delete_comment = "dd", reply = "r", toggle_node = "t", - toggle_comment_resolved = "p", - toggle_discussion_resolved = "P", + toggle_discussion_resolved = "p", relative = "editor", position = "left", size = "20%",