Skip to content
Snippets Groups Projects
Commit 941b6a97 authored by Bob Van Landuyt :neckbeard:'s avatar Bob Van Landuyt :neckbeard: :sunglasses:
Browse files

Merge branch '360584-more-filters-on-type-of-work' into 'master'

Add filters by milestone, author, and assignee to task by type

See merge request gitlab-org/gitlab!88134
parents 20dcb46c 3e137d0b
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -27,7 +27,10 @@ def tasks_by_type
label_ids: Array(params[:label_ids]),
project_ids: Array(params[:project_ids]),
created_after: @created_after.to_time.utc.beginning_of_day,
created_before: @created_before.to_time.utc.end_of_day
created_before: @created_before.to_time.utc.end_of_day,
author_username: params[:author_username],
assignee_username: params[:assignee_username],
milestone_id: params[:milestone_id]
})
end
 
Loading
Loading
Loading
Loading
@@ -55,7 +55,10 @@ def format_result(result)
end
 
def finder_params
{ include_subgroups: true, group_id: group.id }.merge(params.slice(:created_after, :created_before))
{
include_subgroups: true,
group_id: group.id
}.merge(params.slice(:created_after, :created_before, :author_username, :milestone_title, :assignee_username))
end
 
# rubocop: disable CodeReuse/ActiveRecord
Loading
Loading
Loading
Loading
@@ -13,6 +13,8 @@
let_it_be(:label_for_subgroup) { create(:group_label, group: group) }
let_it_be(:other_label) { create(:group_label, group: other_group) }
let_it_be(:project) { create(:project, group: group) }
let_it_be(:assignee) { create(:user) }
let_it_be(:milestone) { create(:milestone, group: group) }
 
let(:params) do
{
Loading
Loading
@@ -32,6 +34,7 @@
 
before do
group.add_reporter(user)
group.add_developer(assignee)
end
 
shared_examples '#counts_by_labels' do
Loading
Loading
@@ -39,6 +42,8 @@
create(factory_name, {
:created_at => 3.days.ago,
:labels => [label],
:assignees => [assignee],
:milestone => milestone,
project_attribute_name => project
})
end
Loading
Loading
@@ -118,6 +123,30 @@ def label_count_for(label, result)
 
it { expect(label_count_for(label, subject)).to eq(1) }
end
context 'when filtering by `author_username`' do
before do
params[:params][:author_username] = with_label.author.username
end
it { expect(label_count_for(label, subject)).to eq(1) }
end
context 'when filtering by `assignee_username`' do
before do
params[:params][:assignee_username] = [assignee.username]
end
it { expect(label_count_for(label, subject)).to eq(1) }
end
context 'when filtering by `milestone_title`' do
before do
params[:params][:milestone_title] = milestone.title
end
it { expect(label_count_for(label, subject)).to eq(1) }
end
end
 
shared_examples '#top_labels' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment