Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3b704818
Commit
3b704818
authored
Sep 01, 2020
by
Fabian Schneider
Committed by
Fabio Pitino
Sep 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust badge key text and width limits
parent
4c375307
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
9 deletions
+15
-9
changelogs/unreleased/231238-adjust-badge-key-limits.yml
changelogs/unreleased/231238-adjust-badge-key-limits.yml
+5
-0
lib/gitlab/badge/coverage/template.rb
lib/gitlab/badge/coverage/template.rb
+2
-2
lib/gitlab/badge/pipeline/template.rb
lib/gitlab/badge/pipeline/template.rb
+2
-2
lib/gitlab/badge/template.rb
lib/gitlab/badge/template.rb
+2
-1
spec/lib/gitlab/badge/coverage/template_spec.rb
spec/lib/gitlab/badge/coverage/template_spec.rb
+2
-2
spec/lib/gitlab/badge/pipeline/template_spec.rb
spec/lib/gitlab/badge/pipeline/template_spec.rb
+2
-2
No files found.
changelogs/unreleased/231238-adjust-badge-key-limits.yml
0 → 100644
View file @
3b704818
---
title
:
Adjust badge key text and width limits
merge_request
:
40199
author
:
Fabian Schneider @fabsrc
type
:
changed
lib/gitlab/badge/coverage/template.rb
View file @
3b704818
...
@@ -25,7 +25,7 @@ module Gitlab
...
@@ -25,7 +25,7 @@ module Gitlab
end
end
def
key_text
def
key_text
if
@key_text
&&
@key_text
.
size
<=
MAX_KEY_SIZE
if
@key_text
&&
@key_text
.
size
<=
MAX_KEY_
TEXT_
SIZE
@key_text
@key_text
else
else
@entity
.
to_s
@entity
.
to_s
...
@@ -37,7 +37,7 @@ module Gitlab
...
@@ -37,7 +37,7 @@ module Gitlab
end
end
def
key_width
def
key_width
if
@key_width
&&
@key_width
.
between?
(
1
,
MAX_KEY_
SIZE
)
if
@key_width
&&
@key_width
.
between?
(
1
,
MAX_KEY_
WIDTH
)
@key_width
@key_width
else
else
62
62
...
...
lib/gitlab/badge/pipeline/template.rb
View file @
3b704818
...
@@ -29,7 +29,7 @@ module Gitlab
...
@@ -29,7 +29,7 @@ module Gitlab
end
end
def
key_text
def
key_text
if
@key_text
&&
@key_text
.
size
<=
MAX_KEY_SIZE
if
@key_text
&&
@key_text
.
size
<=
MAX_KEY_
TEXT_
SIZE
@key_text
@key_text
else
else
@entity
.
to_s
@entity
.
to_s
...
@@ -41,7 +41,7 @@ module Gitlab
...
@@ -41,7 +41,7 @@ module Gitlab
end
end
def
key_width
def
key_width
if
@key_width
&&
@key_width
.
between?
(
1
,
MAX_KEY_
SIZE
)
if
@key_width
&&
@key_width
.
between?
(
1
,
MAX_KEY_
WIDTH
)
@key_width
@key_width
else
else
62
62
...
...
lib/gitlab/badge/template.rb
View file @
3b704818
...
@@ -6,7 +6,8 @@ module Gitlab
...
@@ -6,7 +6,8 @@ module Gitlab
# Abstract template class for badges
# Abstract template class for badges
#
#
class
Template
class
Template
MAX_KEY_SIZE
=
128
MAX_KEY_TEXT_SIZE
=
64
MAX_KEY_WIDTH
=
512
def
initialize
(
badge
)
def
initialize
(
badge
)
@entity
=
badge
.
entity
@entity
=
badge
.
entity
...
...
spec/lib/gitlab/badge/coverage/template_spec.rb
View file @
3b704818
...
@@ -22,7 +22,7 @@ RSpec.describe Gitlab::Badge::Coverage::Template do
...
@@ -22,7 +22,7 @@ RSpec.describe Gitlab::Badge::Coverage::Template do
context
'when its size is larger than the max allowed value'
do
context
'when its size is larger than the max allowed value'
do
before
do
before
do
allow
(
badge
).
to
receive
(
:customization
).
and_return
({
key_text:
't'
*
129
})
allow
(
badge
).
to
receive
(
:customization
).
and_return
({
key_text:
't'
*
65
})
end
end
it
'returns default value'
do
it
'returns default value'
do
...
@@ -76,7 +76,7 @@ RSpec.describe Gitlab::Badge::Coverage::Template do
...
@@ -76,7 +76,7 @@ RSpec.describe Gitlab::Badge::Coverage::Template do
context
'when it is larger than the max allowed value'
do
context
'when it is larger than the max allowed value'
do
before
do
before
do
allow
(
badge
).
to
receive
(
:customization
).
and_return
({
key_width:
129
})
allow
(
badge
).
to
receive
(
:customization
).
and_return
({
key_width:
513
})
end
end
it
'returns default value'
do
it
'returns default value'
do
...
...
spec/lib/gitlab/badge/pipeline/template_spec.rb
View file @
3b704818
...
@@ -22,7 +22,7 @@ RSpec.describe Gitlab::Badge::Pipeline::Template do
...
@@ -22,7 +22,7 @@ RSpec.describe Gitlab::Badge::Pipeline::Template do
context
'when its size is larger than the max allowed value'
do
context
'when its size is larger than the max allowed value'
do
before
do
before
do
allow
(
badge
).
to
receive
(
:customization
).
and_return
({
key_text:
't'
*
129
})
allow
(
badge
).
to
receive
(
:customization
).
and_return
({
key_text:
't'
*
65
})
end
end
it
'returns default value'
do
it
'returns default value'
do
...
@@ -54,7 +54,7 @@ RSpec.describe Gitlab::Badge::Pipeline::Template do
...
@@ -54,7 +54,7 @@ RSpec.describe Gitlab::Badge::Pipeline::Template do
context
'when it is larger than the max allowed value'
do
context
'when it is larger than the max allowed value'
do
before
do
before
do
allow
(
badge
).
to
receive
(
:customization
).
and_return
({
key_width:
129
})
allow
(
badge
).
to
receive
(
:customization
).
and_return
({
key_width:
513
})
end
end
it
'returns default value'
do
it
'returns default value'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment