Fix excess queries and audit code for the datagrids.

Review Request #13366 — Created Oct. 22, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

The new query tests for the datagrids unveiled a number of excess
queries when working with Local Sites. We were querying one Local Site
per row when viewing any review request datagrid on a Local Site. This
was due to the lack of any select_related or equivalent.

This change fixes that, significantly reducing the overhead and the
removing the padded excess queries in the unit tests.

In the process, I've audited the code, cleaned up some calls to help
avoid potential problems down the road, and reduced additional queries
that involved Local Sites, helping keep queries simpler on a standard
setup.

Unit tests pass.

Tested all the datagrids, making sure there were no apparent regressions.

Commits

Files