summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-03-05 18:24:49 +0000
committerFilipa Lacerda <filipa@gitlab.com>2018-03-05 18:24:49 +0000
commit8ec0fd0a42d0c166d103433f58513e3bb94e5e7b (patch)
tree778a3c7c32ea59d7b8e52a1db3485c7c761397f7 /lib/api/entities.rb
parentd0b3d1201d4a465208cd7993409d628272920a9b (diff)
parent5656a1d608aa6c1ab703e8051bd460efe92dc5de (diff)
downloadgitlab-ce-8ec0fd0a42d0c166d103433f58513e3bb94e5e7b.tar.gz
[ci skip] Merge branch 'master' into 38587-pipelines-empty-state
* master: (52 commits) Projects and groups badges API Keep a commit around if its sha is present #43691: DiffNotes not counted by ContributionsCalendar Cleanup after adding MR diff's commit_count Fix MR merge commit cross-references to the MR itself Fix n+1 issue by not reloading fully loaded blobs Add "added" type on changelog Use limited count queries also for scoped searches Update changelog Rename quick actions handler Adds updated_at filter to issues and merge_requests API Update API: add search param to branches Add changelog entry LabelsSelect DropdownValueCollapsed Component LabelsSelect DropdownValue Component LabelsSelect DropdownTitle Component LabelsSelect DropdownSearchInput Component LabelsSelect DropdownHiddenInput Component LabelsSelect DropdownHeader Component LabelsSelect DropdownFooter Component ...
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r--lib/api/entities.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 0c8ec7dd5f5..e5bcbface6b 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -1235,5 +1235,23 @@ module API
expose :startline
expose :project_id
end
+
+ class BasicBadgeDetails < Grape::Entity
+ expose :link_url
+ expose :image_url
+ expose :rendered_link_url do |badge, options|
+ badge.rendered_link_url(options.fetch(:project, nil))
+ end
+ expose :rendered_image_url do |badge, options|
+ badge.rendered_image_url(options.fetch(:project, nil))
+ end
+ end
+
+ class Badge < BasicBadgeDetails
+ expose :id
+ expose :kind do |badge|
+ badge.type == 'ProjectBadge' ? 'project' : 'group'
+ end
+ end
end
end