Add/Remove Reviewers and Assignees (#38)

Adds APIs for the ability to add or remove reviewers and assignees to a merge request. The eligible reviewers and assignees are pulled from the current members of a project.
This commit is contained in:
Harrison (Harry) Cramer
2023-08-16 21:42:53 -04:00
committed by GitHub
parent 6274746d4b
commit 844e093294
10 changed files with 368 additions and 44 deletions

View File

@@ -244,15 +244,6 @@ local current_file_path = function()
return vim.fn.fnamemodify(path, ':p')
end
-- Function to join two tables
local function join_tables(table1, table2)
for _, value in ipairs(table2) do
table.insert(table1, value)
end
return table1
end
local random = math.random
local function uuid()
local template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
@@ -266,6 +257,36 @@ local attach_uuid = function(str)
return { text = str, id = uuid() }
end
local join_tables = function(table1, table2)
for _, value in ipairs(table2) do
table.insert(table1, value)
end
return table1
end
local contains = function(array, search_value)
for _, value in ipairs(array) do
if value == search_value then
return true
end
end
return false
end
local extract = function(t, property)
local resultTable = {}
for _, value in ipairs(t) do
if value[property] then
table.insert(resultTable, value[property])
end
end
return resultTable
end
M.extract = extract
M.contains = contains
M.attach_uuid = attach_uuid
M.join_tables = join_tables
M.get_relative_file_path = get_relative_file_path