Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-09-21 20:02:09 +0300
committerRémy Coutable <remy@rymai.me>2016-09-22 12:21:57 +0300
commitd626b429a7d42609a5e385e0de6d4c09f539e4ff (patch)
treead6d5b8168d85d9f28dde52e016fa6e5000236c3 /app/helpers/application_helper.rb
parent98b3d6ce695a9751f72adc35bc09f82eb2f624a4 (diff)
Hotfix the issuable counters when filtering by multiple labels
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ed41bf04fc0..2163a437c48 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -286,8 +286,19 @@ module ApplicationHelper
}
state_title = titles[state] || state.to_s.humanize
- count = records.public_send(state).size
- html = content_tag :span, state_title
+ 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
if count.present?
html += " "