diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-08-24 19:26:04 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-08-24 19:26:04 +0000 |
commit | 90441e85ddb0b24550521c458fe12baf65e5352c (patch) | |
tree | 92f0344c0abcf80c29575a5278b018c10cea65cb /lib/api/entities.rb | |
parent | 7b0b2417491e28e5536688e0fca96829a4cb7900 (diff) | |
parent | e43c4060b67c1996b917bc00afa72122d1d00004 (diff) | |
download | gitlab-ce-90441e85ddb0b24550521c458fe12baf65e5352c.tar.gz |
Merge branch 'entity-api-web-url' into 'master'
api: expose web_url for project entities
## What does this MR do?
Adds a `web_url` field to project snippet, issues, and merge request API returned objects.
## Are there points in the code the reviewer needs to double check?
Tests. Are they sufficient? (I'm working on getting them to pass.)
## Why was this MR needed?
Creating the URL for an MR or issue from the MR is tedious in API libraries; it's easy for Gitlab to just provide it.
## What are the relevant issue numbers?
N/A
## Screenshots (if relevant)
N/A
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [x] API support added
- Tests
- [x] Added for this feature/bug
- [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !5631
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r-- | lib/api/entities.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 3ecdc7d448a..5e8729c5342 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 |