diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-10-07 00:34:03 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-10-07 00:34:03 +0300 |
commit | a625757cb469612409d47326241818ddf4fca982 (patch) | |
tree | a55a61bd79751823be6373f47a55459110ea1c06 /lib | |
parent | 567bcf14cfc4e54e672516377c18fe65aa193556 (diff) | |
parent | b4d614bdbcb50f506c56eaa180d7b3f3055884a8 (diff) |
Merge branch 'fix-already-selected-activity-link' into 'master'
Fix inconsistent highlighting of already selected activity nav-links
## What does this MR do?
* Remove edge case where user could deselect an activity nav-link (which seems to be returning all the events)
* Explicitly add an `All` tab to return all the events
## Are there points in the code the reviewer needs to double check?
Shouldn't be
## Why was this MR needed?
Resolves existing UI inconsistency
## Screenshots (if relevant)
Before:
![4OzkoQVJYc](/uploads/fd2a7fdbde2159e875482ec7b828fe60/4OzkoQVJYc.gif)
After:
![E0lj8UhEUU](/uploads/7eb5155861eb79d72957de04c9f172c9/E0lj8UhEUU.gif)
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
- [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
## What are the relevant issue numbers?
* Closes #21631
* Closes #21452
See merge request !6091
Diffstat (limited to 'lib')
-rw-r--r-- | lib/event_filter.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/event_filter.rb b/lib/event_filter.rb index 668d2fa41b3..96e70e37e8f 100644 --- a/lib/event_filter.rb +++ b/lib/event_filter.rb @@ -2,8 +2,8 @@ class EventFilter attr_accessor :params class << self - def default_filter - %w{ push issues merge_requests team} + def all + 'all' end def push @@ -35,18 +35,21 @@ class EventFilter return events unless params.present? filter = params.dup - actions = [] - actions << Event::PUSHED if filter.include? 'push' - actions << Event::MERGED if filter.include? 'merged' - if filter.include? 'team' - actions << Event::JOINED - actions << Event::LEFT + case filter + when EventFilter.push + actions = [Event::PUSHED] + when EventFilter.merged + actions = [Event::MERGED] + when EventFilter.comments + actions = [Event::COMMENTED] + when EventFilter.team + actions = [Event::JOINED, Event::LEFT] + when EventFilter.all + actions = [Event::PUSHED, Event::MERGED, Event::COMMENTED, Event::JOINED, Event::LEFT] end - actions << Event::COMMENTED if filter.include? 'comments' - events.where(action: actions) end |