diff options
Diffstat (limited to 'lib/gitlab/badge/pipeline/template.rb')
-rw-r--r-- | lib/gitlab/badge/pipeline/template.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/gitlab/badge/pipeline/template.rb b/lib/gitlab/badge/pipeline/template.rb index 0d3d44135e7..781897fab4b 100644 --- a/lib/gitlab/badge/pipeline/template.rb +++ b/lib/gitlab/badge/pipeline/template.rb @@ -24,10 +24,16 @@ module Gitlab def initialize(badge) @entity = badge.entity @status = badge.status + @key_text = badge.customization.dig(:key_text) + @key_width = badge.customization.dig(:key_width) end def key_text - @entity.to_s + if @key_text && @key_text.size <= MAX_KEY_SIZE + @key_text + else + @entity.to_s + end end def value_text @@ -35,7 +41,11 @@ module Gitlab end def key_width - 62 + if @key_width && @key_width.between?(1, MAX_KEY_SIZE) + @key_width + else + 62 + end end def value_width |