summaryrefslogtreecommitdiff
path: root/lib/api/badges.rb
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/api/badges.rb
parent8e75748aabcbcea411f8bbc68936805bc2b5ff0c (diff)
downloadgitlab-ce-8a3fdede9607c806d88856d46d4f5394b630a006.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/badges.rb')
-rw-r--r--lib/api/badges.rb8
1 files changed, 7 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)