Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2018-05-27 18:53:21 +0300
committerJan Provaznik <jprovaznik@gitlab.com>2018-05-28 09:59:33 +0300
commit1d766bfbdf8f11d176beb99d139edc6150e3f032 (patch)
tree67556f23c32343d213aa0a8442ad4d4f7c0bb2bd /app/services/boards
parentbee339ad10fc4d4bd94a406eb0d24d7759d73972 (diff)
Replace `.exists` with `EXISTS ()`
`.exists` should not be used because it's an internal ActiveRecord method, but we can easily generate the same sql query with `EXISTS`.
Diffstat (limited to 'app/services/boards')
-rw-r--r--app/services/boards/issues/list_service.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/app/services/boards/issues/list_service.rb b/app/services/boards/issues/list_service.rb
index ac70a99c2c5..5a961ac89e4 100644
--- a/app/services/boards/issues/list_service.rb
+++ b/app/services/boards/issues/list_service.rb
@@ -63,7 +63,7 @@ module Boards
def without_board_labels(issues)
return issues unless board_label_ids.any?
- issues.where.not(issues_label_links.limit(1).arel.exists)
+ issues.where.not('EXISTS (?)', issues_label_links.limit(1))
end
def issues_label_links
@@ -71,10 +71,8 @@ module Boards
end
def with_list_label(issues)
- issues.where(
- LabelLink.where("label_links.target_type = 'Issue' AND label_links.target_id = issues.id")
- .where("label_links.label_id = ?", list.label_id).limit(1).arel.exists
- )
+ issues.where('EXISTS (?)', LabelLink.where("label_links.target_type = 'Issue' AND label_links.target_id = issues.id")
+ .where("label_links.label_id = ?", list.label_id).limit(1))
end
end
end