diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-17 16:55:46 -0200 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 14:58:27 -0200 |
commit | 1e5ea6e7e05cd45fc56d0341ac8b5c32e57779b5 (patch) | |
tree | 12e4773fcdcd8b3aa8ea7d74a8bdde918fda0a31 /app/finders | |
parent | 530aae9080942646b130510e970d9d82c009d8e5 (diff) | |
download | gitlab-ce-1e5ea6e7e05cd45fc56d0341ac8b5c32e57779b5.tar.gz |
Return only labels that user have access on IssuableFinder#labels
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/issuable_finder.rb | 13 | ||||
-rw-r--r-- | app/finders/labels_finder.rb | 4 |
2 files changed, 7 insertions, 10 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 41ea8f801c1..e27986ef95b 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -124,15 +124,12 @@ class IssuableFinder def labels return @labels if defined?(@labels) - if labels? && !filter_by_no_label? - @labels = Label.where(title: label_names) - - if projects - @labels = LabelsFinder.new(current_user, project_ids: projects, title: label_names).execute + @labels = + if labels? && !filter_by_no_label? + LabelsFinder.new(current_user, project_ids: projects, title: label_names).execute + else + Label.none end - else - @labels = Label.none - end end def assignee? diff --git a/app/finders/labels_finder.rb b/app/finders/labels_finder.rb index 5ee2e1ee6e8..48fd1280ed2 100644 --- a/app/finders/labels_finder.rb +++ b/app/finders/labels_finder.rb @@ -45,7 +45,7 @@ class LabelsFinder < UnionFinder params[:project_id].presence end - def project_ids + def projects_ids params[:project_ids].presence end @@ -70,7 +70,7 @@ class LabelsFinder < UnionFinder @projects = available_projects @projects = @projects.in_namespace(group_id) if group_id - @projects = @projects.where(id: project_ids) if project_ids + @projects = @projects.where(id: projects_ids) if projects_ids @projects = @projects.reorder(nil) @projects |