From 24704acc77ebc85d653fc22d3fe9c7e5eb2a707d Mon Sep 17 00:00:00 2001 From: sue445 Date: Wed, 2 Aug 2017 15:18:17 +0900 Subject: Expose target_iid in Events API --- lib/api/entities.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/api/entities.rb') diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 5cdc441e8cb..0a71c976c7e 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -483,7 +483,7 @@ module API class Event < Grape::Entity expose :title, :project_id, :action_name - expose :target_id, :target_type, :author_id + expose :target_id, :target_iid, :target_type, :author_id expose :data, :target_title expose :created_at expose :note, using: Entities::Note, if: ->(event, options) { event.note? } -- cgit v1.2.1 From fb5b2d8d0eb544630f97233731466a18380301c7 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 2 Aug 2017 10:16:17 +0000 Subject: Extending API for protected branches --- lib/api/entities.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/api/entities.rb') diff --git a/lib/api/entities.rb b/lib/api/entities.rb index ce25be34ec4..f31fe704e0c 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -240,7 +240,7 @@ module API end expose :protected do |repo_branch, options| - ProtectedBranch.protected?(options[:project], repo_branch.name) + ::ProtectedBranch.protected?(options[:project], repo_branch.name) end expose :developers_can_push do |repo_branch, options| @@ -299,6 +299,19 @@ module API expose :deleted_file?, as: :deleted_file end + class ProtectedRefAccess < Grape::Entity + expose :access_level + expose :access_level_description do |protected_ref_access| + protected_ref_access.humanize + end + end + + class ProtectedBranch < Grape::Entity + expose :name + expose :push_access_levels, using: Entities::ProtectedRefAccess + expose :merge_access_levels, using: Entities::ProtectedRefAccess + end + class Milestone < Grape::Entity expose :id, :iid expose :project_id, if: -> (entity, options) { entity&.project_id } -- cgit v1.2.1