summaryrefslogtreecommitdiff
path: root/app/finders/labels_finder.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/finders/labels_finder.rb')
-rw-r--r--app/finders/labels_finder.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/app/finders/labels_finder.rb b/app/finders/labels_finder.rb
index 95e62cdb02a..865f093f04a 100644
--- a/app/finders/labels_finder.rb
+++ b/app/finders/labels_finder.rb
@@ -4,9 +4,8 @@ class LabelsFinder < UnionFinder
@params = params
end
- def execute(authorized_only: true)
- @authorized_only = authorized_only
-
+ def execute(skip_authorization: false)
+ @skip_authorization = skip_authorization
items = find_union(label_ids, Label)
items = with_title(items)
sort(items)
@@ -14,7 +13,7 @@ class LabelsFinder < UnionFinder
private
- attr_reader :current_user, :params, :authorized_only
+ attr_reader :current_user, :params, :skip_authorization
def label_ids
label_ids = []
@@ -50,7 +49,7 @@ class LabelsFinder < UnionFinder
end
def projects_ids
- params[:project_ids].presence
+ params[:project_ids]
end
def title
@@ -70,17 +69,17 @@ class LabelsFinder < UnionFinder
end
def find_project
- if authorized_only
- available_projects.find_by(id: project_id)
- else
+ if skip_authorization
Project.find_by(id: project_id)
+ else
+ available_projects.find_by(id: project_id)
end
end
def projects
return @projects if defined?(@projects)
- @projects = authorized_only ? available_projects : Project.all
+ @projects = skip_authorization ? Project.all : available_projects
@projects = @projects.in_namespace(group_id) if group_id
@projects = @projects.where(id: projects_ids) if projects_ids
@projects = @projects.reorder(nil)