Skip to content

Use `without_count` for audit event records paginated with `paginate_without_counts`

Manoj M J requested to merge gitlab-pagination-without-count-fix into master

What does this MR do?

Fix 1 (backend change only, no visible UI change):

While working on the comment !20912 (comment 254868656), I noticed that in Admin Audit Events, even while using paginate_without_counts for pagination, the records itself do not have without_count called on them, and this leads to a count query being executed anyway.

So, it is essential that we call without_count on the ActiveRecord collection, when paginating using paginate_without_counts

Documentation: https://github.com/kaminari/kaminari#paginating-without-issuing-select-count-query

This is how pagination without page numbers looks like (current behaviour in Admin Audit Logs UI)

Screenshot_2019-12-05_at_1.22.55_PM

Fix 2:

Update: This change is dropped from this MR as per discussion with UX. Commit has been rebased to only include changes in Fix 1.

I also noticed that in Project and Group Audit Logs UI, we paginate with page numbers - which is different from what we follow in Admin Audit Logs - where we paginate without page numbers.

Hence, to bring feature parity between the two, I have changed pagination in Project and Group Audit Logs UI to use pagination without page numbers.

Before:

Pagination has page numbers (this is different from the behaviour in Admin Audit Events UI)

Screenshot_2019-12-05_at_1.29.50_PM

After:

Pagination does not have page numbers (this is in-line with current behaviour in Admin Audit Events UI)

Screenshot_2019-12-05_at_1.28.20_PM

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Manoj M J

Merge request reports