diff options
author | Oxan van Leeuwen <oxan@oxanvanleeuwen.nl> | 2016-11-22 18:11:34 +0100 |
---|---|---|
committer | Oxan van Leeuwen <oxan@oxanvanleeuwen.nl> | 2016-12-04 23:07:22 +0100 |
commit | bb447383c527d28bf4f884df18462e22be05f3b4 (patch) | |
tree | 82c72bd1de0a05b52f0549d593aeacd012e720f9 /spec | |
parent | ef6a91af123d8b773ba8a286cf986abaedee6c33 (diff) | |
download | gitlab-ce-bb447383c527d28bf4f884df18462e22be05f3b4.tar.gz |
Add issue events filter and make sure "All" really shows everything
Currently, the EventFilter whitelists event types for the "All" filter.
This has gotten outdated, which causes the confusing behaviour of the
"All" tab not really showing all events. To make matters worse, by
default no tab at all is selected, which does show all events, so
selecting the "All" tab actually hides some events.
Fix this by:
- Making sure All always includes all activity, by abolishing the
whitelist and just returning all events instead.
- Make the All tab selected by default.
- Add Issue events tab to include the specific events around opening
and closing issues, since there was no specific filter to see them
yet.
Fixes #24826
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/fixtures/event_filter.html.haml | 4 | ||||
-rw-r--r-- | spec/lib/event_filter_spec.rb | 15 |
2 files changed, 16 insertions, 3 deletions
diff --git a/spec/javascripts/fixtures/event_filter.html.haml b/spec/javascripts/fixtures/event_filter.html.haml index 95e248cadf8..5477c6075f0 100644 --- a/spec/javascripts/fixtures/event_filter.html.haml +++ b/spec/javascripts/fixtures/event_filter.html.haml @@ -12,6 +12,10 @@ %span Merge events %li + %a.event-filter-link{ id: "issue_event_filter", title: "Filter by issue events", href: "/dashboard/activity"} + %span + Issue events + %li %a.event-filter-link{ id: "comments_event_filter", title: "Filter by comments", href: "/dashboard/activity"} %span Comments diff --git a/spec/lib/event_filter_spec.rb b/spec/lib/event_filter_spec.rb index a6d8e6927e0..ec2f66b1136 100644 --- a/spec/lib/event_filter_spec.rb +++ b/spec/lib/event_filter_spec.rb @@ -7,6 +7,10 @@ describe EventFilter, lib: true do let!(:push_event) { create(:event, action: Event::PUSHED, project: public_project, target: public_project, author: source_user) } let!(:merged_event) { create(:event, action: Event::MERGED, project: public_project, target: public_project, author: source_user) } + let!(:created_event) { create(:event, action: Event::CREATED, project: public_project, target: public_project, author: source_user) } + let!(:updated_event) { create(:event, action: Event::UPDATED, project: public_project, target: public_project, author: source_user) } + let!(:closed_event) { create(:event, action: Event::CLOSED, project: public_project, target: public_project, author: source_user) } + let!(:reopened_event) { create(:event, action: Event::REOPENED, project: public_project, target: public_project, author: source_user) } let!(:comments_event) { create(:event, action: Event::COMMENTED, project: public_project, target: public_project, author: source_user) } let!(:joined_event) { create(:event, action: Event::JOINED, project: public_project, target: public_project, author: source_user) } let!(:left_event) { create(:event, action: Event::LEFT, project: public_project, target: public_project, author: source_user) } @@ -21,6 +25,11 @@ describe EventFilter, lib: true do expect(events).to contain_exactly(merged_event) end + it 'applies issue filter' do + events = EventFilter.new(EventFilter.issue).apply_filter(Event.all) + expect(events).to contain_exactly(created_event, updated_event, closed_event, reopened_event) + end + it 'applies comments filter' do events = EventFilter.new(EventFilter.comments).apply_filter(Event.all) expect(events).to contain_exactly(comments_event) @@ -33,17 +42,17 @@ describe EventFilter, lib: true do it 'applies all filter' do events = EventFilter.new(EventFilter.all).apply_filter(Event.all) - expect(events).to contain_exactly(push_event, merged_event, comments_event, joined_event, left_event) + expect(events).to contain_exactly(push_event, merged_event, created_event, updated_event, closed_event, reopened_event, comments_event, joined_event, left_event) end it 'applies no filter' do events = EventFilter.new(nil).apply_filter(Event.all) - expect(events).to contain_exactly(push_event, merged_event, comments_event, joined_event, left_event) + expect(events).to contain_exactly(push_event, merged_event, created_event, updated_event, closed_event, reopened_event, comments_event, joined_event, left_event) end it 'applies unknown filter' do events = EventFilter.new('').apply_filter(Event.all) - expect(events).to contain_exactly(push_event, merged_event, comments_event, joined_event, left_event) + expect(events).to contain_exactly(push_event, merged_event, created_event, updated_event, closed_event, reopened_event, comments_event, joined_event, left_event) end end end |