Commit c777bb91 authored by James Edwards-Jones's avatar James Edwards-Jones

Issue index CSV uses currently applied filters

parent 17600f5f
......@@ -19,6 +19,7 @@
#
class IssuableFinder
NONE = '0'
VALID_PARAMS = %i(scope state group_id project_id milestone_title assignee_id search label_name sort)
attr_accessor :current_user, :params
......
......@@ -21,7 +21,7 @@
- if current_user
= link_to url_for(params.merge(format: :atom, private_token: current_user.private_token)), class: 'btn append-right-10 has-tooltip', title: 'Subscribe' do
= icon('rss')
= link_to namespace_project_issues_path(@project.namespace, @project, :csv), class: 'btn append-right-10 has-tooltip', title: 'Download CSV' do
= link_to namespace_project_issues_path(@project.namespace, @project, params.permit(IssuableFinder::VALID_PARAMS).merge(format: :csv)), class: 'btn append-right-10 has-tooltip', title: 'Download CSV' do
= icon('download')
- if can? current_user, :create_issue, @project
= link_to new_namespace_project_issue_path(@project.namespace,
......
......@@ -23,6 +23,13 @@ describe 'Issues csv', feature: true do
expect(csv.count).to eq 31
end
it 'uses filters from issue index' do
visit namespace_project_issues_path(project.namespace, project, state: :closed)
click_on 'Download CSV'
expect(csv.count).to eq 0
end
context 'includes' do
let(:label1) { create(:label, project: project, title: 'Feature') }
let(:label2) { create(:label, project: project, title: 'labels') }
......
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