summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-09-23 15:16:11 +0200
committerRémy Coutable <remy@rymai.me>2016-09-30 12:02:54 +0200
commit9b361a3f44eec7a301565318ce86742f2f139a9d (patch)
treedd207e7aeaecb21ffa383e972985e1b9a7834cc6 /app/finders
parentf9887a10d43fc3b382d1ef270431823d1d4491a6 (diff)
downloadgitlab-ce-9b361a3f44eec7a301565318ce86742f2f139a9d.tar.gz
Take filters in account in issuable counters
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/issuable_finder.rb15
1 files changed, 5 insertions, 10 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index 8f9ef8f725c..9f170428100 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -183,17 +183,12 @@ class IssuableFinder
end
def by_state(items)
- case params[:state]
- when 'closed'
- items.closed
- when 'merged'
- items.respond_to?(:merged) ? items.merged : items.closed
- when 'all'
- items
- when 'opened'
- items.opened
+ params[:state] ||= 'all'
+
+ if items.respond_to?(params[:state])
+ items.public_send(params[:state])
else
- raise 'You must specify default state'
+ items
end
end