summaryrefslogtreecommitdiff
path: root/lib/api/v3
diff options
context:
space:
mode:
authorSaverio Miroddi <saverio.pub2@gmail.com>2017-08-15 18:49:28 +0200
committerSaverio Miroddi <saverio.pub2@gmail.com>2017-08-15 18:49:28 +0200
commitcd80a9075f5f2b3150c909a6cd56e7c8f239bd51 (patch)
tree58f0fba91c72ec86cc744f026d62d06050b20efa /lib/api/v3
parent1d6ba597028142511af8c9863f81073278ccd927 (diff)
parent97b768508c360d2ae767a559b5037fe464061440 (diff)
downloadgitlab-ce-cd80a9075f5f2b3150c909a6cd56e7c8f239bd51.tar.gz
Merge branch 'master' into sm-cherry-pick-list-commits-in-message
Diffstat (limited to 'lib/api/v3')
-rw-r--r--lib/api/v3/entities.rb12
-rw-r--r--lib/api/v3/projects.rb2
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/api/v3/entities.rb b/lib/api/v3/entities.rb
index 4a2e9c9cbb0..a9a35f2a4bd 100644
--- a/lib/api/v3/entities.rb
+++ b/lib/api/v3/entities.rb
@@ -25,14 +25,24 @@ module API
expose(:downvote?) { |note| false }
end
+ class PushEventPayload < Grape::Entity
+ expose :commit_count, :action, :ref_type, :commit_from, :commit_to
+ expose :ref, :commit_title
+ end
+
class Event < Grape::Entity
expose :title, :project_id, :action_name
expose :target_id, :target_type, :author_id
- expose :data, :target_title
+ expose :target_title
expose :created_at
expose :note, using: Entities::Note, if: ->(event, options) { event.note? }
expose :author, using: ::API::Entities::UserBasic, if: ->(event, options) { event.author }
+ expose :push_event_payload,
+ as: :push_data,
+ using: PushEventPayload,
+ if: -> (event, _) { event.push? }
+
expose :author_username do |event, options|
event.author&.username
end
diff --git a/lib/api/v3/projects.rb b/lib/api/v3/projects.rb
index eb090453b48..449876c10d9 100644
--- a/lib/api/v3/projects.rb
+++ b/lib/api/v3/projects.rb
@@ -388,6 +388,8 @@ module API
if user_project.forked_from_project.nil?
user_project.create_forked_project_link(forked_to_project_id: user_project.id, forked_from_project_id: forked_from_project.id)
+
+ ::Projects::ForksCountService.new(forked_from_project).refresh_cache
else
render_api_error!("Project already forked", 409)
end