diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-01-05 17:54:56 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-01-05 17:54:56 +0000 |
commit | 0c3ec51f404d6a976472fe069bd4249fdd65aee1 (patch) | |
tree | 5b8efe62b12bbe30d5863936a6a6d3f7003de25d /app/finders | |
parent | c618e5aa6d1381566616f76676ec9c8903468046 (diff) | |
parent | 06d4f07a041a70fe9462bcae47b1b191908347ab (diff) | |
download | gitlab-ce-0c3ec51f404d6a976472fe069bd4249fdd65aee1.tar.gz |
Merge branch 'issue_40500' into 'master'
Improve filtering issues by label performance
Closes #40500 and #37143
See merge request gitlab-org/gitlab-ce!16136
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/issuable_finder.rb | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index b46ec5e5350..493e7985d75 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -374,19 +374,14 @@ class IssuableFinder end def by_label(items) - if labels? + return items unless labels? + + items = if filter_by_no_label? - items = items.without_label + items.without_label else - items = items.with_label(label_names, params[:sort]) - items_projects = projects(items) - - if items_projects - label_ids = LabelsFinder.new(current_user, project_ids: items_projects).execute(skip_authorization: true).select(:id) - items = items.where(labels: { id: label_ids }) - end + items.with_label(label_names, params[:sort]) end - end items end |