summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-22 09:06:20 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-22 09:06:20 +0000
commit8a3fdede9607c806d88856d46d4f5394b630a006 (patch)
tree869139549ac3bd687fcf1286d6dd50b1d785702e /lib
parent8e75748aabcbcea411f8bbc68936805bc2b5ff0c (diff)
downloadgitlab-ce-8a3fdede9607c806d88856d46d4f5394b630a006.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/badges.rb8
-rw-r--r--lib/api/entities.rb1
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/api/badges.rb b/lib/api/badges.rb
index ba554e00a16..e987c24c707 100644
--- a/lib/api/badges.rb
+++ b/lib/api/badges.rb
@@ -33,7 +33,11 @@ module API
get ":id/badges" do
source = find_source(source_type, params[:id])
- present_badges(source, paginate(source.badges))
+ badges = source.badges
+ name = params[:name]
+ badges = badges.with_name(name) if name
+
+ present_badges(source, paginate(badges))
end
desc "Preview a badge from a #{source_type}." do
@@ -80,6 +84,7 @@ module API
params do
requires :link_url, type: String, desc: 'URL of the badge link'
requires :image_url, type: String, desc: 'URL of the badge image'
+ optional :name, type: String, desc: 'Name for the badge'
end
post ":id/badges" do
source = find_source_if_admin(source_type)
@@ -100,6 +105,7 @@ module API
params do
optional :link_url, type: String, desc: 'URL of the badge link'
optional :image_url, type: String, desc: 'URL of the badge image'
+ optional :name, type: String, desc: 'Name for the badge'
end
put ":id/badges/:badge_id" do
source = find_source_if_admin(source_type)
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 3ff74dd9d38..21648b0f59a 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -1736,6 +1736,7 @@ module API
end
class BasicBadgeDetails < Grape::Entity
+ expose :name
expose :link_url
expose :image_url
expose :rendered_link_url do |badge, options|