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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
d626b429
Commit
d626b429
authored
Sep 21, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hotfix the issuable counters when filtering by multiple labels
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
98b3d6ce
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+13
-2
spec/features/issues/filter_by_labels_spec.rb
spec/features/issues/filter_by_labels_spec.rb
+13
-7
No files found.
app/helpers/application_helper.rb
View file @
d626b429
...
@@ -286,7 +286,18 @@ module ApplicationHelper
...
@@ -286,7 +286,18 @@ module ApplicationHelper
}
}
state_title
=
titles
[
state
]
||
state
.
to_s
.
humanize
state_title
=
titles
[
state
]
||
state
.
to_s
.
humanize
count
=
records
.
public_send
(
state
).
size
records_with_state
=
records
.
public_send
(
state
)
# When filtering by multiple labels, the result of query.count is a Hash
# of the form { issuable_id1 => N, issuable_id2 => N }, where N is the
# number of labels selected. The ugly "trick" is to load the issuables
# as an array and get the size of the array...
# We should probably try to solve this properly in the future.
# See https://gitlab.com/gitlab-org/gitlab-ce/issues/22414
label_names
=
Array
(
params
.
fetch
(
:label_name
,
[]))
records_with_state
=
records_with_state
.
to_a
if
label_names
.
many?
count
=
records_with_state
.
size
html
=
content_tag
:span
,
state_title
html
=
content_tag
:span
,
state_title
if
count
.
present?
if
count
.
present?
...
...
spec/features/issues/filter_by_labels_spec.rb
View file @
d626b429
...
@@ -6,20 +6,19 @@ feature 'Issue filtering by Labels', feature: true do
...
@@ -6,20 +6,19 @@ feature 'Issue filtering by Labels', feature: true do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let!
(
:user
)
{
create
(
:user
)}
let!
(
:user
)
{
create
(
:user
)}
let!
(
:label
)
{
create
(
:label
,
project:
project
)
}
let!
(
:label
)
{
create
(
:label
,
project:
project
)
}
let
(
:bug
)
{
create
(
:label
,
project:
project
,
title:
'bug'
)
}
let
(
:feature
)
{
create
(
:label
,
project:
project
,
title:
'feature'
)
}
let
(
:enhancement
)
{
create
(
:label
,
project:
project
,
title:
'enhancement'
)
}
let
(
:issue1
)
{
create
(
:issue
,
title:
"Bugfix1"
,
project:
project
)
}
let
(
:issue2
)
{
create
(
:issue
,
title:
"Bugfix2"
,
project:
project
)
}
let
(
:issue3
)
{
create
(
:issue
,
title:
"Feature1"
,
project:
project
)
}
before
do
before
do
bug
=
create
(
:label
,
project:
project
,
title:
'bug'
)
feature
=
create
(
:label
,
project:
project
,
title:
'feature'
)
enhancement
=
create
(
:label
,
project:
project
,
title:
'enhancement'
)
issue1
=
create
(
:issue
,
title:
"Bugfix1"
,
project:
project
)
issue1
.
labels
<<
bug
issue1
.
labels
<<
bug
issue2
=
create
(
:issue
,
title:
"Bugfix2"
,
project:
project
)
issue2
.
labels
<<
bug
issue2
.
labels
<<
bug
issue2
.
labels
<<
enhancement
issue2
.
labels
<<
enhancement
issue3
=
create
(
:issue
,
title:
"Feature1"
,
project:
project
)
issue3
.
labels
<<
feature
issue3
.
labels
<<
feature
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
...
@@ -159,6 +158,13 @@ feature 'Issue filtering by Labels', feature: true do
...
@@ -159,6 +158,13 @@ feature 'Issue filtering by Labels', feature: true do
wait_for_ajax
wait_for_ajax
end
end
it
'shows a correct "Open" counter'
do
page
.
within
'.issues-state-filters'
do
expect
(
page
).
not_to
have_content
"{
#{
issue2
.
id
}
=> 1}"
expect
(
page
).
to
have_content
"Open 1"
end
end
it
'shows issue "Bugfix2" in issues list'
do
it
'shows issue "Bugfix2" in issues list'
do
expect
(
page
).
to
have_content
"Bugfix2"
expect
(
page
).
to
have_content
"Bugfix2"
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