diff options
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/entities.rb | 10 | ||||
-rw-r--r-- | lib/api/groups.rb | 3 | ||||
-rw-r--r-- | lib/api/helpers/issues_helpers.rb | 6 | ||||
-rw-r--r-- | lib/api/helpers/projects_helpers.rb | 8 | ||||
-rw-r--r-- | lib/api/helpers/services_helpers.rb | 1 | ||||
-rw-r--r-- | lib/api/issues.rb | 25 | ||||
-rw-r--r-- | lib/api/pipelines.rb | 23 | ||||
-rw-r--r-- | lib/api/projects.rb | 4 | ||||
-rw-r--r-- | lib/api/releases.rb | 4 |
9 files changed, 17 insertions, 67 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 9e820f00c42..53774d4db1a 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -400,7 +400,6 @@ module API end class GroupDetail < Group - expose :runners_token, if: lambda { |group, options| options[:user_can_admin_group] } expose :projects, using: Entities::Project do |group, options| projects = GroupProjectsFinder.new( group: group, @@ -1045,12 +1044,7 @@ module API expose :job_events # Expose serialized properties expose :properties do |service, options| - # TODO: Simplify as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 - if service.data_fields_present? - service.data_fields.as_json.slice(*service.api_field_names) - else - service.properties.slice(*service.api_field_names) - end + service.properties.slice(*service.api_field_names) end end @@ -1286,7 +1280,7 @@ module API expose :author, using: Entities::UserBasic, if: -> (release, _) { release.author.present? } expose :commit, using: Entities::Commit, if: lambda { |_, _| can_download_code? } expose :upcoming_release?, as: :upcoming_release - expose :milestones, using: Entities::Milestone, if: -> (release, _) { release.milestones.present? } + expose :milestone, using: Entities::Milestone, if: -> (release, _) { release.milestone.present? } expose :assets do expose :assets_count, as: :count do |release, _| diff --git a/lib/api/groups.rb b/lib/api/groups.rb index 9d1628de7e5..4ae9b8c70d3 100644 --- a/lib/api/groups.rb +++ b/lib/api/groups.rb @@ -173,8 +173,7 @@ module API options = { with: params[:with_projects] ? Entities::GroupDetail : Entities::Group, - current_user: current_user, - user_can_admin_group: can?(current_user, :admin_group, group) + current_user: current_user } group, options = with_custom_attributes(group, options) diff --git a/lib/api/helpers/issues_helpers.rb b/lib/api/helpers/issues_helpers.rb index e272b13f3ae..8addcd18fe3 100644 --- a/lib/api/helpers/issues_helpers.rb +++ b/lib/api/helpers/issues_helpers.rb @@ -11,9 +11,6 @@ module API params :optional_issues_params_ee do end - params :optional_issue_not_params_ee do - end - def self.update_params_at_least_one_of [ :assignee_id, @@ -38,11 +35,8 @@ module API args = declared_params.merge(args) args.delete(:id) - args[:not] ||= {} args[:milestone_title] ||= args.delete(:milestone) - args[:not][:milestone_title] ||= args[:not]&.delete(:milestone) args[:label_name] ||= args.delete(:labels) - args[:not][:label_name] ||= args[:not]&.delete(:labels) args[:scope] = args[:scope].underscore if args[:scope] args[:sort] = "#{args[:order_by]}_#{args[:sort]}" diff --git a/lib/api/helpers/projects_helpers.rb b/lib/api/helpers/projects_helpers.rb index 07f0386d14d..f247c722c44 100644 --- a/lib/api/helpers/projects_helpers.rb +++ b/lib/api/helpers/projects_helpers.rb @@ -56,14 +56,6 @@ module API use :optional_project_params_ee end - params :optional_create_project_params_ee do - end - - params :optional_create_project_params do - use :optional_project_params - use :optional_create_project_params_ee - end - params :optional_filter_params_ee do end diff --git a/lib/api/helpers/services_helpers.rb b/lib/api/helpers/services_helpers.rb index eba4ebb4b6e..5331de3c035 100644 --- a/lib/api/helpers/services_helpers.rb +++ b/lib/api/helpers/services_helpers.rb @@ -1,3 +1,4 @@ +# coding: utf-8 # frozen_string_literal: true module API diff --git a/lib/api/issues.rb b/lib/api/issues.rb index d06550191ad..215178478d0 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -9,35 +9,28 @@ module API before { authenticate_non_get! } helpers do - params :negatable_issue_filter_params do + params :issues_stats_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' + optional :milestone, type: String, desc: 'Return issues for a specific milestone' optional :iids, type: Array[Integer], desc: 'The IID array of issues' optional :search, type: String, desc: 'Search issues for text present in the title, description, or any combination of these' optional :in, type: String, desc: '`title`, `description`, or a string joining them with comma' + optional :created_after, type: DateTime, desc: 'Return issues created after the specified time' + optional :created_before, type: DateTime, desc: 'Return issues created before the specified time' + optional :updated_after, type: DateTime, desc: 'Return issues updated after the specified time' + optional :updated_before, type: DateTime, desc: 'Return issues updated before the specified time' optional :author_id, type: Integer, desc: 'Return issues which are authored by the user with the given ID' optional :author_username, type: String, desc: 'Return issues which are authored by the user with the given username' mutually_exclusive :author_id, :author_username optional :assignee_id, types: [Integer, String], integer_none_any: true, - desc: 'Return issues which are assigned to the user with the given ID' + desc: 'Return issues which are assigned to the user with the given ID' optional :assignee_username, type: Array[String], check_assignees_count: true, - coerce_with: Validations::CheckAssigneesCount.coerce, - desc: 'Return issues which are assigned to the user with the given username' + coerce_with: Validations::CheckAssigneesCount.coerce, + desc: 'Return issues which are assigned to the user with the given username' mutually_exclusive :assignee_id, :assignee_username - end - - params :issues_stats_params do - use :negatable_issue_filter_params - optional :created_after, type: DateTime, desc: 'Return issues created after the specified time' - optional :created_before, type: DateTime, desc: 'Return issues created before the specified time' - optional :updated_after, type: DateTime, desc: 'Return issues updated after the specified time' - optional :updated_before, type: DateTime, desc: 'Return issues updated before the specified time' - - optional :not, type: Hash do - use :negatable_issue_filter_params - end optional :scope, type: String, values: %w[created-by-me assigned-to-me created_by_me assigned_to_me all], desc: 'Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`' diff --git a/lib/api/pipelines.rb b/lib/api/pipelines.rb index e09d226a13f..9e888368e7b 100644 --- a/lib/api/pipelines.rb +++ b/lib/api/pipelines.rb @@ -69,19 +69,6 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Gets a the latest pipeline for the project branch' do - detail 'This feature was introduced in GitLab 12.3' - success Entities::Pipeline - end - params do - optional :ref, type: String, desc: 'branch ref of pipeline' - end - get ':id/pipelines/latest' do - authorize! :read_pipeline, latest_pipeline - - present latest_pipeline, with: Entities::Pipeline - end - desc 'Gets a specific pipeline for the project' do detail 'This feature was introduced in GitLab 8.11' success Entities::Pipeline @@ -157,15 +144,7 @@ module API helpers do def pipeline - strong_memoize(:pipeline) do - user_project.ci_pipelines.find(params[:pipeline_id]) - end - end - - def latest_pipeline - strong_memoize(:latest_pipeline) do - user_project.latest_pipeline_for_ref(params[:ref]) - end + @pipeline ||= user_project.ci_pipelines.find(params[:pipeline_id]) end end end diff --git a/lib/api/projects.rb b/lib/api/projects.rb index c28b03ac6c9..74de9fcec68 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -68,8 +68,6 @@ module API params :create_params do optional :namespace_id, type: Integer, desc: 'Namespace ID for the new project. Default to the user namespace.' optional :import_url, type: String, desc: 'URL from which the project is imported' - optional :template_name, type: String, desc: "Name of template from which to create project" - mutually_exclusive :import_url, :template_name end def load_projects @@ -157,7 +155,7 @@ module API optional :name, type: String, desc: 'The name of the project' optional :path, type: String, desc: 'The path of the repository' at_least_one_of :name, :path - use :optional_create_project_params + use :optional_project_params use :create_params end post do diff --git a/lib/api/releases.rb b/lib/api/releases.rb index 4238529142c..5a31581c4da 100644 --- a/lib/api/releases.rb +++ b/lib/api/releases.rb @@ -54,7 +54,7 @@ module API requires :url, type: String end end - optional :milestones, type: Array, desc: 'The titles of the related milestones', default: [] + optional :milestone, type: String, desc: 'The title of the related milestone' optional :released_at, type: DateTime, desc: 'The date when the release will be/was ready. Defaults to the current time.' end post ':id/releases' do @@ -80,7 +80,7 @@ module API optional :name, type: String, desc: 'The name of the release' optional :description, type: String, desc: 'Release notes with markdown support' optional :released_at, type: DateTime, desc: 'The date when the release will be/was ready.' - optional :milestones, type: Array, desc: 'The titles of the related milestones' + optional :milestone, type: String, desc: 'The title of the related milestone' end put ':id/releases/:tag_name', requirements: RELEASE_ENDPOINT_REQUIREMENTS do authorize_update_release! |