diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /lib/gitlab/ci/badge/template.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'lib/gitlab/ci/badge/template.rb')
-rw-r--r-- | lib/gitlab/ci/badge/template.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/gitlab/ci/badge/template.rb b/lib/gitlab/ci/badge/template.rb index 0580dad72ba..d514a8577bd 100644 --- a/lib/gitlab/ci/badge/template.rb +++ b/lib/gitlab/ci/badge/template.rb @@ -8,6 +8,7 @@ module Gitlab::Ci class Template MAX_KEY_TEXT_SIZE = 64 MAX_KEY_WIDTH = 512 + DEFAULT_KEY_WIDTH = 62 def initialize(badge) @entity = badge.entity @@ -15,7 +16,11 @@ module Gitlab::Ci end def key_text - raise NotImplementedError + if @key_text && @key_text.size <= MAX_KEY_TEXT_SIZE + @key_text + else + @entity.to_s + end end def value_text @@ -23,7 +28,11 @@ module Gitlab::Ci end def key_width - raise NotImplementedError + if @key_width && @key_width.between?(1, MAX_KEY_WIDTH) + @key_width + else + DEFAULT_KEY_WIDTH + end end def value_width |