Files
gitlab.nvim/lua/gitlab/actions/miscellaneous.lua
Harrison (Harry) Cramer e4eabaf71d Release 1/24/26 (#519)
* Fix: Jumping to renamed files (#484)

* fix: prevent "cursor position outside buffer" error

* fix: swap file_name and old_file_name in reviewer data

`old_file_name` is not set to the empty string for un-renamed files anymore, because then we can
remove the empty-line check in `comment_helpers.go` which was used to replace the empty string with
the current file name anyway.

* fix: add old_file_name to discussion root node data

* fix: also consider old_file_name when jumping to the reviewer

This fixes jumping to renamed files, however, may not work for comments that
were created on renamed files with the previous version of `gitlab.nvim` as
that version assigned the `file_name` and `old_file_name` incorrectly.

* refactor: don't shadow variable

* fix: check file_name or old_file_name based on which SHA comment belongs to

* 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)

* Feat: Enable toggling date format between relative and absolute (#491)

* Fix: Add opts to help popup (#492)

* Fix: Force start_line for jumping to diagnostic to be inside buffer (#494)

* fix: redefine colors after reloading colorscheme (#500)

* Fix: Use path instead of oldpath as fallback for unrenamed files (#496)

* Fix: Use file_name when old_file_name is not set (#495)

* fix(ci): fix lua tests (#501)

* Proxy Support (#499)

* feat(ci): Cancel obsolete after a new commit is pushed in an open PR (#503)

* fix: start and clean up winbar timer properly (#513)

This is a PATCH.

* fix: put attach_file markdown on new line (#512)

This is a PATCH PR.

* docs: fix incorrect value for 'relative' option to Split (#511)

This is a PATCH.

* docs: add default keybinding maps available in the help (#506)

This is a PATCH change.

* feat: enable setting discussion tree options (#509)

* docs: add description of `refresh_data` function

* fix: only set gitlab filetype in one place

* feat: set some useful window options for the discussion tree split

This is a PATCH PR.

---------

Co-authored-by: Jakub F. Bortlík <jakub.bortlik@proton.me>
Co-authored-by: Jonathan Duck <Duckbrain30@gmail.com>
Co-authored-by: Kitsios Konstantinos <kitsios.konst@gmail.com>
Co-authored-by: Mohammad Akbari <makbari@users.noreply.github.com>
2026-01-24 10:04:47 -05:00

47 lines
1.3 KiB
Lua

local state = require("gitlab.state")
local u = require("gitlab.utils")
local job = require("gitlab.job")
local M = {}
M.attach_file = function()
local attachment_dir = state.settings.attachment_dir
if not attachment_dir or attachment_dir == "" then
u.notify("Must provide valid attachment_dir in plugin setup", vim.log.levels.ERROR)
return
end
local files = u.list_files_in_folder(attachment_dir)
if files == nil then
u.notify(string.format("Could not list files in %s", attachment_dir), vim.log.levels.ERROR)
return
end
vim.ui.select(files, {
prompt = "Choose attachment",
}, function(choice)
if not choice then
return
end
local full_path = attachment_dir .. u.path_separator .. choice
local body = { file_path = full_path, file_name = choice }
job.run_job("/attachment", "POST", body, function(data)
local markdown = data.markdown
vim.api.nvim_put({ markdown }, "l", true, false)
end)
end)
end
---Toggle the value in a "Boolean buffer"
M.toggle_bool = function()
local bufnr = vim.api.nvim_get_current_buf()
local current_val = u.get_buffer_text(bufnr)
vim.schedule(function()
u.switch_can_edit_buf(bufnr, true)
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { u.toggle_string_bool(current_val) })
u.switch_can_edit_buf(bufnr, false)
end)
end
return M