Add Filtering, HealthCheck, Better Tests (#350)
feat: add filtering when choosing merge requests (#346) feat: Add healthcheck (#345) refactor: Move to gomock (#349) feat: Makes the remote of the plugin configurable (#348) This is a #MINOR release.
This commit is contained in:
committed by
GitHub
parent
aa5d3c1f52
commit
4ae623cd65
@@ -40,7 +40,7 @@ M.default_auth_provider = function()
|
||||
return auth_token, gitlab_url, err
|
||||
end
|
||||
|
||||
-- These are the default settings for the plugin
|
||||
--- These are the default settings for the plugin
|
||||
M.settings = {
|
||||
auth_provider = M.default_auth_provider,
|
||||
port = nil, -- choose random port
|
||||
@@ -57,7 +57,8 @@ M.settings = {
|
||||
},
|
||||
},
|
||||
connection_settings = {
|
||||
insecure = true,
|
||||
insecure = false,
|
||||
remote = "origin",
|
||||
},
|
||||
attachment_dir = "",
|
||||
keymaps = {
|
||||
@@ -375,72 +376,12 @@ M.set_global_keymaps = function()
|
||||
end
|
||||
|
||||
-- Merges user settings into the default settings, overriding them
|
||||
---@param args Settings
|
||||
---@return Settings
|
||||
M.merge_settings = function(args)
|
||||
M.settings = u.merge(M.settings, args)
|
||||
|
||||
-- Check deprecated settings and alert users!
|
||||
if M.settings.dialogue ~= nil then
|
||||
u.notify("The dialogue field has been deprecated, please remove it from your setup function", vim.log.levels.WARN)
|
||||
end
|
||||
|
||||
if M.settings.reviewer == "delta" then
|
||||
u.notify(
|
||||
"Delta is no longer a supported reviewer, please use diffview and update your setup function",
|
||||
vim.log.levels.ERROR
|
||||
)
|
||||
return false
|
||||
end
|
||||
|
||||
local diffview_ok, _ = pcall(require, "diffview")
|
||||
if not diffview_ok then
|
||||
u.notify("Please install diffview, it is required")
|
||||
return false
|
||||
end
|
||||
|
||||
local removed_fields_in_user_config = {}
|
||||
local removed_settings_fields = {
|
||||
"discussion_tree.add_emoji",
|
||||
"discussion_tree.copy_node_url",
|
||||
"discussion_tree.delete_comment",
|
||||
"discussion_tree.delete_emoji",
|
||||
"discussion_tree.edit_comment",
|
||||
"discussion_tree.jump_to_file",
|
||||
"discussion_tree.jump_to_reviewer",
|
||||
"discussion_tree.open_in_browser",
|
||||
"discussion_tree.publish_draft",
|
||||
"discussion_tree.refresh_data",
|
||||
"discussion_tree.reply",
|
||||
"discussion_tree.switch_view",
|
||||
"discussion_tree.toggle_all_discussions",
|
||||
"discussion_tree.toggle_draft_mode",
|
||||
"discussion_tree.toggle_node",
|
||||
"discussion_tree.toggle_resolved",
|
||||
"discussion_tree.toggle_resolved_discussions",
|
||||
"discussion_tree.toggle_tree_type",
|
||||
"discussion_tree.toggle_unresolved_discussions",
|
||||
"help",
|
||||
"popup.keymaps.next_field",
|
||||
"popup.keymaps.prev_field",
|
||||
"popup.perform_action",
|
||||
"popup.perform_linewise_action",
|
||||
"review_pane", -- Only relevant for the Delta reviewer
|
||||
}
|
||||
for _, field in ipairs(removed_settings_fields) do
|
||||
if u.get_nested_field(M.settings, field) ~= nil then
|
||||
table.insert(removed_fields_in_user_config, field)
|
||||
end
|
||||
end
|
||||
|
||||
if #removed_fields_in_user_config ~= 0 then
|
||||
u.notify(
|
||||
"The following settings fields have been removed:\n" .. table.concat(removed_fields_in_user_config, "\n"),
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
end
|
||||
|
||||
M.settings.file_separator = (u.is_windows() and "\\" or "/")
|
||||
|
||||
return true
|
||||
return M.settings
|
||||
end
|
||||
|
||||
M.print_settings = function()
|
||||
@@ -616,7 +557,18 @@ M.dependencies = {
|
||||
endpoint = "/merge_requests",
|
||||
key = "merge_requests",
|
||||
state = "MERGE_REQUESTS",
|
||||
refresh = false,
|
||||
refresh = true,
|
||||
method = "POST",
|
||||
body = function(opts)
|
||||
local listArgs = {
|
||||
label = opts and opts.label or {},
|
||||
notlabel = opts and opts.notlabel or {},
|
||||
}
|
||||
for k, v in pairs(listArgs) do
|
||||
listArgs[k] = v
|
||||
end
|
||||
return listArgs
|
||||
end,
|
||||
},
|
||||
discussion_data = {
|
||||
-- key is missing here...
|
||||
|
||||
Reference in New Issue
Block a user