From e43c4060b67c1996b917bc00afa72122d1d00004 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 2 Aug 2016 13:37:04 -0400 Subject: api: expose web_url for project entities This allows web hooks to have a URL back to entities without having to generate it themselves. --- lib/api/entities.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/api') diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 66b85ab1793..e6bc23b97d7 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -177,6 +177,10 @@ module API # TODO (rspeicher): Deprecated; remove in 9.0 expose(:expires_at) { |snippet| nil } + + expose :web_url do |snippet, options| + Gitlab::UrlBuilder.build(snippet) + end end class ProjectEntity < Grape::Entity @@ -206,6 +210,10 @@ module API expose :user_notes_count expose :upvotes, :downvotes expose :due_date + + expose :web_url do |issue, options| + Gitlab::UrlBuilder.build(issue) + end end class ExternalIssue < Grape::Entity @@ -229,6 +237,10 @@ module API expose :user_notes_count expose :should_remove_source_branch?, as: :should_remove_source_branch expose :force_remove_source_branch?, as: :force_remove_source_branch + + expose :web_url do |merge_request, options| + Gitlab::UrlBuilder.build(merge_request) + end end class MergeRequestChanges < MergeRequest -- cgit v1.2.1