Skip to content

Commit

Permalink
remove toggle_comment_resolved option and related stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
johnybx committed Nov 15, 2023
1 parent 82e55f3 commit 481cc1f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 28 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
24 changes: 1 addition & 23 deletions lua/gitlab/actions/discussions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion lua/gitlab/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 🤷
Expand Down
3 changes: 1 addition & 2 deletions lua/gitlab/state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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%",
Expand Down

0 comments on commit 481cc1f

Please sign in to comment.