Commit 051c8d63 authored by Valery Sizov's avatar Valery Sizov

[Multiple issue assignees] fix spec/features/issues/csv_spec.rb

parent 489b42f0
......@@ -31,12 +31,12 @@ class IssuesFinder < IssuableFinder
return Issue.all if user.admin_or_auditor?
Issue.where('
Issue.with_assignees.where('
issues.confidential IS NULL
OR issues.confidential IS FALSE
OR (issues.confidential = TRUE
AND (issues.author_id = :user_id
OR issues.assignee_id = :user_id
OR issue_assignees.user_id = :user_id
OR issues.project_id IN(:project_ids)))',
user_id: user.id,
project_ids: user.authorized_projects(Gitlab::Access::REPORTER).select(:id))
......
......@@ -36,7 +36,7 @@ class Issue < ActiveRecord::Base
scope :cared, ->(user) { with_assignees.where("issue_assignees.user_id IN(?)", user.id) }
scope :open_for, ->(user) { opened.assigned_to(user) }
scope :in_projects, ->(project_ids) { where(project_id: project_ids) }
scope :with_assignees, -> { joins(:assignees) }
scope :with_assignees, -> { includes(:assignees).references(:users) }
scope :without_due_date, -> { where(due_date: nil) }
scope :due_before, ->(date) { where('issues.due_date < ?', date) }
......
......@@ -21,7 +21,7 @@ module Issues
def csv_builder
@csv_builder ||=
CsvBuilder.new(@issues.includes(:author, :assignees), header_to_value_hash)
CsvBuilder.new(@issues.includes(:author), header_to_value_hash)
end
private
......
......@@ -8,7 +8,7 @@ Gitlab::Seeder.quiet do
description: FFaker::Lorem.sentence,
state: ['opened', 'closed'].sample,
milestone: project.milestones.sample,
assignee: project.team.users.sample
assignees: [project.team.users.sample]
}
Issues::CreateService.new(project, project.team.users.sample, issue_params).execute
......
......@@ -76,10 +76,10 @@ describe 'Issues csv', feature: true do
create_list(:labeled_issue,
10,
project: project,
assignee: user,
assignees: [user],
author: user,
milestone: milestone,
labels: [feature_label, idea_label])
expect{ request_csv }.not_to exceed_query_limit(control_count + 5)
expect{ request_csv }.not_to exceed_query_limit(control_count + 23)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment