Commit 71046be7 authored by Yorick Peterse's avatar Yorick Peterse

Backport API::Issues parameters from EE

This backports the parameters that EE adds to API::Issues, and wraps
them in conditionals so they are only used in EE.
parent b5623d3f
# frozen_string_literal: true
module API
module Helpers
module IssuesHelpers
def self.update_params_at_least_one_of
[
:assignee_id,
:assignee_ids,
:confidential,
:created_at,
:description,
:discussion_locked,
:due_date,
:labels,
:milestone_id,
:state_event,
:title
]
end
end
end
end
......@@ -8,15 +8,6 @@ module API
helpers ::Gitlab::IssuableMetadata
# EE::API::Issues would override the following helpers
helpers do
params :issues_params_ee do
end
params :issue_params_ee do
end
end
helpers do
# rubocop: disable CodeReuse/ActiveRecord
def find_issues(args = {})
......@@ -33,6 +24,16 @@ module API
end
# rubocop: enable CodeReuse/ActiveRecord
if Gitlab.ee?
params :issues_params_ee do
optional :weight, types: [Integer, String], integer_none_any: true, desc: 'The weight of the issue'
end
params :issue_params_ee do
optional :weight, type: Integer, desc: 'The weight of the issue'
end
end
params :issues_params do
optional :labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :milestone, type: String, desc: 'Milestone title'
......@@ -57,7 +58,7 @@ module API
optional :confidential, type: Boolean, desc: 'Filter confidential or public issues'
use :pagination
use :issues_params_ee
use :issues_params_ee if Gitlab.ee?
end
params :issue_params do
......@@ -70,7 +71,7 @@ module API
optional :confidential, type: Boolean, desc: 'Boolean parameter if the issue should be confidential'
optional :discussion_locked, type: Boolean, desc: " Boolean parameter indicating if the issue's discussion is locked"
use :issue_params_ee
use :issue_params_ee if Gitlab.ee?
end
end
......@@ -219,8 +220,8 @@ module API
desc: 'Date time when the issue was updated. Available only for admins and project owners.'
optional :state_event, type: String, values: %w[reopen close], desc: 'State of the issue'
use :issue_params
at_least_one_of :title, :description, :assignee_ids, :assignee_id, :milestone_id, :discussion_locked,
:labels, :created_at, :due_date, :confidential, :state_event
at_least_one_of(*Helpers::IssuesHelpers.update_params_at_least_one_of)
end
# rubocop: disable CodeReuse/ActiveRecord
put ':id/issues/:issue_iid' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment