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
6c8bab8f
Commit
6c8bab8f
authored
Jan 27, 2021
by
Michelle Gill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove MR List counts if they cannot be generated
parent
47b7970a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
40 deletions
+40
-40
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+6
-18
changelogs/unreleased/291170-issue-mr-list-tabs-icons-sometimes-display-as.yml
.../291170-issue-mr-list-tabs-icons-sometimes-display-as.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+0
-3
spec/features/issuables/issuable_list_spec.rb
spec/features/issuables/issuable_list_spec.rb
+1
-1
spec/helpers/issuables_helper_spec.rb
spec/helpers/issuables_helper_spec.rb
+28
-18
No files found.
app/helpers/issuables_helper.rb
View file @
6c8bab8f
...
...
@@ -215,24 +215,12 @@ module IssuablesHelper
state_title
=
titles
[
state
]
||
state
.
to_s
.
humanize
html
=
content_tag
(
:span
,
state_title
)
if
display_count
count
=
issuables_count_for_state
(
issuable_type
,
state
)
tag
=
if
count
==
-
1
tooltip
=
_
(
"Couldn't calculate number of %{issuables}."
)
%
{
issuables:
issuable_type
.
to_s
.
humanize
(
capitalize:
false
)
}
content_tag
(
:span
,
'?'
,
class:
'badge badge-pill has-tooltip'
,
aria:
{
label:
tooltip
},
title:
tooltip
)
else
content_tag
(
:span
,
number_with_delimiter
(
count
),
class:
'badge badge-pill'
)
end
html
<<
" "
<<
tag
return
html
.
html_safe
unless
display_count
count
=
issuables_count_for_state
(
issuable_type
,
state
)
if
count
!=
-
1
html
<<
" "
<<
content_tag
(
:span
,
number_with_delimiter
(
count
),
class:
'badge badge-pill'
)
end
html
.
html_safe
...
...
changelogs/unreleased/291170-issue-mr-list-tabs-icons-sometimes-display-as.yml
0 → 100644
View file @
6c8bab8f
---
title
:
Remove MR List counts if they cannot be generated
merge_request
:
52698
author
:
type
:
fixed
locale/gitlab.pot
View file @
6c8bab8f
...
...
@@ -8133,9 +8133,6 @@ msgstr ""
msgid "Could not upload your designs as one or more files uploaded are not supported."
msgstr ""
msgid "Couldn't calculate number of %{issuables}."
msgstr ""
msgid "Country"
msgstr ""
...
...
spec/features/issuables/issuable_list_spec.rb
View file @
6c8bab8f
...
...
@@ -53,7 +53,7 @@ RSpec.describe 'issuable list', :js do
visit_issuable_list
(
:issue
)
expect
(
page
).
to
have_text
(
'Open
? Closed ? All ?
'
)
expect
(
page
).
to
have_text
(
'Open
Closed All
'
)
end
it
"counts merge requests closing issues icons for each issue"
do
...
...
spec/helpers/issuables_helper_spec.rb
View file @
6c8bab8f
...
...
@@ -72,28 +72,38 @@ RSpec.describe IssuablesHelper do
let
(
:user
)
{
create
(
:user
)
}
describe
'state text'
do
before
do
allow
(
helper
).
to
receive
(
:issuables_count_for_state
).
and_return
(
42
)
end
it
'returns "Open" when state is :opened'
do
expect
(
helper
.
issuables_state_counter_text
(
:issues
,
:opened
,
true
))
.
to
eq
(
'<span>Open</span> <span class="badge badge-pill">42</span>'
)
end
context
'when number of issuables can be generated'
do
before
do
allow
(
helper
).
to
receive
(
:issuables_count_for_state
).
and_return
(
42
)
end
it
'returns "Closed" when state is :closed'
do
expect
(
helper
.
issuables_state_counter_text
(
:issues
,
:closed
,
true
))
.
to
eq
(
'<span>Closed</span> <span class="badge badge-pill">42</span>'
)
it
'returns navigation with badges'
do
expect
(
helper
.
issuables_state_counter_text
(
:issues
,
:opened
,
true
))
.
to
eq
(
'<span>Open</span> <span class="badge badge-pill">42</span>'
)
expect
(
helper
.
issuables_state_counter_text
(
:issues
,
:closed
,
true
))
.
to
eq
(
'<span>Closed</span> <span class="badge badge-pill">42</span>'
)
expect
(
helper
.
issuables_state_counter_text
(
:merge_requests
,
:merged
,
true
))
.
to
eq
(
'<span>Merged</span> <span class="badge badge-pill">42</span>'
)
expect
(
helper
.
issuables_state_counter_text
(
:merge_requests
,
:all
,
true
))
.
to
eq
(
'<span>All</span> <span class="badge badge-pill">42</span>'
)
end
end
it
'returns "Merged" when state is :merg
ed'
do
expect
(
helper
.
issuables_state_counter_text
(
:merge_requests
,
:merged
,
true
))
.
to
eq
(
'<span>Merged</span> <span class="badge badge-pill">42</span>'
)
end
context
'when count cannot be generat
ed'
do
before
do
allow
(
helper
).
to
receive
(
:issuables_count_for_state
).
and_return
(
-
1
)
end
it
'returns "All" when state is :all'
do
expect
(
helper
.
issuables_state_counter_text
(
:merge_requests
,
:all
,
true
))
.
to
eq
(
'<span>All</span> <span class="badge badge-pill">42</span>'
)
it
'returns avigation without badges'
do
expect
(
helper
.
issuables_state_counter_text
(
:issues
,
:opened
,
true
))
.
to
eq
(
'<span>Open</span>'
)
expect
(
helper
.
issuables_state_counter_text
(
:issues
,
:closed
,
true
))
.
to
eq
(
'<span>Closed</span>'
)
expect
(
helper
.
issuables_state_counter_text
(
:merge_requests
,
:merged
,
true
))
.
to
eq
(
'<span>Merged</span>'
)
expect
(
helper
.
issuables_state_counter_text
(
:merge_requests
,
:all
,
true
))
.
to
eq
(
'<span>All</span>'
)
end
end
end
end
...
...
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