summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2016-08-02 13:37:04 -0400
committerBen Boeckel <ben.boeckel@kitware.com>2016-08-24 10:32:31 -0400
commite43c4060b67c1996b917bc00afa72122d1d00004 (patch)
treee9d170a12995b3ce7f330908d12995fd3f830b01 /lib/api/entities.rb
parent9b470aebb993d7a5745f0e9fc17b207fe46b16fe (diff)
downloadgitlab-ce-e43c4060b67c1996b917bc00afa72122d1d00004.tar.gz
api: expose web_url for project entities
This allows web hooks to have a URL back to entities without having to generate it themselves.
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r--lib/api/entities.rb12
1 files changed, 12 insertions, 0 deletions
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