summaryrefslogtreecommitdiff
path: root/app/services/boards
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-12 21:08:48 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-12 21:08:48 +0000
commit006e89697dd5165f355afc20fc6bb0cdfa7b381a (patch)
tree9095aeb37b2c80f3b0cc5a8dfd27baf93f05b61b /app/services/boards
parent43e3dc2f95a25c600e08f65d4f1c406a1a63ed3d (diff)
downloadgitlab-ce-006e89697dd5165f355afc20fc6bb0cdfa7b381a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/boards')
-rw-r--r--app/services/boards/issues/list_service.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/app/services/boards/issues/list_service.rb b/app/services/boards/issues/list_service.rb
index a9240e1d8a0..699fa17cb65 100644
--- a/app/services/boards/issues/list_service.rb
+++ b/app/services/boards/issues/list_service.rb
@@ -10,7 +10,7 @@ module Boards
end
def execute
- fetch_issues.order_by_position_and_priority
+ fetch_issues.order_by_position_and_priority(with_cte: can_attempt_search_optimization?)
end
# rubocop: disable CodeReuse/ActiveRecord
@@ -63,6 +63,7 @@ module Boards
set_state
set_scope
set_non_archived
+ set_attempt_search_optimizations
params
end
@@ -87,6 +88,16 @@ module Boards
params[:non_archived] = parent.is_a?(Group)
end
+ def set_attempt_search_optimizations
+ return unless can_attempt_search_optimization?
+
+ if board.group_board?
+ params[:attempt_group_search_optimizations] = true
+ else
+ params[:attempt_project_search_optimizations] = true
+ end
+ end
+
# rubocop: disable CodeReuse/ActiveRecord
def board_label_ids
@board_label_ids ||= board.lists.movable.pluck(:label_id)
@@ -113,6 +124,15 @@ module Boards
.where("label_links.label_id = ?", list.label_id).limit(1))
end
# rubocop: enable CodeReuse/ActiveRecord
+
+ def board_group
+ board.group_board? ? parent : parent.group
+ end
+
+ def can_attempt_search_optimization?
+ params[:search].present? &&
+ Feature.enabled?(:board_search_optimization, board_group, default_enabled: false)
+ end
end
end
end