From dbffaaa97e7a195dc5421237392788a03a6b763a Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Tue, 6 Jun 2017 16:20:24 -0500 Subject: =?UTF-8?q?Blob#load=5Fall=5Fdata!=20doesn=E2=80=99t=20need=20an?= =?UTF-8?q?=20argument?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/api/v3/files.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/api/v3') diff --git a/lib/api/v3/files.rb b/lib/api/v3/files.rb index c76acc86504..7b4b3448b6d 100644 --- a/lib/api/v3/files.rb +++ b/lib/api/v3/files.rb @@ -56,7 +56,7 @@ module API blob = repo.blob_at(commit.sha, params[:file_path]) not_found!('File') unless blob - blob.load_all_data!(repo) + blob.load_all_data! status(200) { -- cgit v1.2.1 From ea090291bba6bb665b3631cc5a2659e6673a6959 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 31 May 2017 00:50:53 -0500 Subject: Rename "Slash commands" to "Quick actions" Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/27070 Deprecate "chat commands" in favor of "slash commands" We looked for things like: - `slash commmand` - `slash_command` - `slash-command` - `SlashCommand` --- lib/api/v3/services.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/api/v3') diff --git a/lib/api/v3/services.rb b/lib/api/v3/services.rb index 118c6df6549..2d13d6fabfd 100644 --- a/lib/api/v3/services.rb +++ b/lib/api/v3/services.rb @@ -608,7 +608,7 @@ module API trigger_services.each do |service_slug, settings| helpers do - def chat_command_service(project, service_slug, params) + def slash_command_service(project, service_slug, params) project.services.active.where(template: false).find do |service| service.try(:token) == params[:token] && service.to_param == service_slug.underscore end @@ -633,7 +633,7 @@ module API # This is not accurate, but done to prevent leakage of the project names not_found!('Service') unless project - service = chat_command_service(project, service_slug, params) + service = slash_command_service(project, service_slug, params) result = service.try(:trigger, params) if result -- cgit v1.2.1 From 0430b7644101fc70ed4be6bf69ccf05b900f4cdf Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 21 Jun 2017 13:48:12 +0000 Subject: Enable Style/DotPosition Rubocop :cop: --- lib/api/v3/branches.rb | 8 ++++---- lib/api/v3/entities.rb | 6 +++--- lib/api/v3/notes.rb | 4 ++-- lib/api/v3/tags.rb | 4 ++-- lib/api/v3/users.rb | 22 +++++++++++----------- 5 files changed, 22 insertions(+), 22 deletions(-) (limited to 'lib/api/v3') diff --git a/lib/api/v3/branches.rb b/lib/api/v3/branches.rb index 0a877b960f6..81b13249892 100644 --- a/lib/api/v3/branches.rb +++ b/lib/api/v3/branches.rb @@ -26,8 +26,8 @@ module API delete ":id/repository/branches/:branch", requirements: { branch: /.+/ } do authorize_push_project - result = DeleteBranchService.new(user_project, current_user). - execute(params[:branch]) + result = DeleteBranchService.new(user_project, current_user) + .execute(params[:branch]) if result[:status] == :success status(200) @@ -55,8 +55,8 @@ module API end post ":id/repository/branches" do authorize_push_project - result = CreateBranchService.new(user_project, current_user). - execute(params[:branch_name], params[:ref]) + result = CreateBranchService.new(user_project, current_user) + .execute(params[:branch_name], params[:ref]) if result[:status] == :success present result[:branch], diff --git a/lib/api/v3/entities.rb b/lib/api/v3/entities.rb index 7c5065dee90..c848f52723b 100644 --- a/lib/api/v3/entities.rb +++ b/lib/api/v3/entities.rb @@ -245,9 +245,9 @@ module API expose :job_events, as: :build_events # Expose serialized properties expose :properties do |service, options| - field_names = service.fields. - select { |field| options[:include_passwords] || field[:type] != 'password' }. - map { |field| field[:name] } + field_names = service.fields + .select { |field| options[:include_passwords] || field[:type] != 'password' } + .map { |field| field[:name] } service.properties.slice(*field_names) end end diff --git a/lib/api/v3/notes.rb b/lib/api/v3/notes.rb index 009ec5c6bbd..23fe95e42e4 100644 --- a/lib/api/v3/notes.rb +++ b/lib/api/v3/notes.rb @@ -34,8 +34,8 @@ module API # paginate() only works with a relation. This could lead to a # mismatch between the pagination headers info and the actual notes # array returned, but this is really a edge-case. - paginate(noteable.notes). - reject { |n| n.cross_reference_not_visible_for?(current_user) } + paginate(noteable.notes) + .reject { |n| n.cross_reference_not_visible_for?(current_user) } present notes, with: ::API::V3::Entities::Note else not_found!("Notes") diff --git a/lib/api/v3/tags.rb b/lib/api/v3/tags.rb index c2541de2f50..7e5875cd030 100644 --- a/lib/api/v3/tags.rb +++ b/lib/api/v3/tags.rb @@ -22,8 +22,8 @@ module API delete ":id/repository/tags/:tag_name", requirements: { tag_name: /.+/ } do authorize_push_project - result = ::Tags::DestroyService.new(user_project, current_user). - execute(params[:tag_name]) + result = ::Tags::DestroyService.new(user_project, current_user) + .execute(params[:tag_name]) if result[:status] == :success status(200) diff --git a/lib/api/v3/users.rb b/lib/api/v3/users.rb index f4cda3b2eba..37020019e07 100644 --- a/lib/api/v3/users.rb +++ b/lib/api/v3/users.rb @@ -50,13 +50,13 @@ module API if user.persisted? present user, with: ::API::Entities::UserPublic else - conflict!('Email has already been taken') if User. - where(email: user.email). - count > 0 + conflict!('Email has already been taken') if User + .where(email: user.email) + .count > 0 - conflict!('Username has already been taken') if User. - where(username: user.username). - count > 0 + conflict!('Username has already been taken') if User + .where(username: user.username) + .count > 0 render_validation_error!(user) end @@ -137,11 +137,11 @@ module API user = User.find_by(id: params[:id]) not_found!('User') unless user - events = user.events. - merge(ProjectsFinder.new(current_user: current_user).execute). - references(:project). - with_associations. - recent + events = user.events + .merge(ProjectsFinder.new(current_user: current_user).execute) + .references(:project) + .with_associations + .recent present paginate(events), with: ::API::V3::Entities::Event end -- cgit v1.2.1 From eda30f31041d883787959823b95c0ebef3c762ef Mon Sep 17 00:00:00 2001 From: vanadium23 Date: Fri, 16 Jun 2017 08:28:23 +0300 Subject: Filter archived project in API v3 only if param present --- lib/api/v3/helpers.rb | 5 ++++- lib/api/v3/projects.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/api/v3') diff --git a/lib/api/v3/helpers.rb b/lib/api/v3/helpers.rb index d9e76560d03..4e63aa01c1a 100644 --- a/lib/api/v3/helpers.rb +++ b/lib/api/v3/helpers.rb @@ -38,7 +38,10 @@ module API projects = projects.where(visibility_level: Gitlab::VisibilityLevel.level_value(params[:visibility])) end - projects = projects.where(archived: params[:archived]) + unless params[:archived].nil? + projects = projects.where(archived: to_boolean(params[:archived])) + end + projects.reorder(params[:order_by] => params[:sort]) end end diff --git a/lib/api/v3/projects.rb b/lib/api/v3/projects.rb index 20976b9dd08..eb090453b48 100644 --- a/lib/api/v3/projects.rb +++ b/lib/api/v3/projects.rb @@ -69,7 +69,7 @@ module API end params :filter_params do - optional :archived, type: Boolean, default: false, desc: 'Limit by archived status' + optional :archived, type: Boolean, default: nil, desc: 'Limit by archived status' optional :visibility, type: String, values: %w[public internal private], desc: 'Limit by visibility' optional :search, type: String, desc: 'Return list of authorized projects matching the search criteria' -- cgit v1.2.1