diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-16 18:12:21 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-16 18:12:21 +0000 |
commit | c1436508fa677bbe850e1e13761d2e6b791c698c (patch) | |
tree | 620acc1fdce3c6da394389816060920e46dc4d83 /app/finders/events_finder.rb | |
parent | 3563f193744bf8bca9a1099fe6f6399c8883ec7e (diff) | |
download | gitlab-ce-c1436508fa677bbe850e1e13761d2e6b791c698c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders/events_finder.rb')
-rw-r--r-- | app/finders/events_finder.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/finders/events_finder.rb b/app/finders/events_finder.rb index 4c619f3d7ea..4ed447a90ce 100644 --- a/app/finders/events_finder.rb +++ b/app/finders/events_finder.rb @@ -44,7 +44,6 @@ class EventsFinder events = by_created_at_after(events) events = sort(events) - events = events.with_associations if params[:with_associations] paginated_filtered_by_user_visibility(events) end @@ -113,10 +112,12 @@ class EventsFinder end def paginated_filtered_by_user_visibility(events) + events_count = events.count + events = events.with_associations if params[:with_associations] limited_events = events.page(page).per(per_page) visible_events = limited_events.select { |event| event.visible_to_user?(current_user) } - Kaminari.paginate_array(visible_events, total_count: events.count) + Kaminari.paginate_array(visible_events, total_count: events_count) end def per_page |