Compare IDs instead of model instances when possible.
Review Request #10380 — Created Jan. 13, 2019 and submitted
We had several regularly-invoked model instance comparisons in the
product that could result in unwanted database queries. These were
usually found in accessibility checks, comparing if a requesting user
matches the user owning an object.
To reduce overhead, we now compare the IDs, which is faster even if the
instances were already loaded. This cuts down on a number of queries in
Test coverage for these checks have been improved, with many
accessibility checks that were previously covered implicitly through
other test suites now having explicit test coverage.
There's also a fix for a bad permission name, which impacted the tests.
StatusUpdateneeded to be
Unit tests pass.
- Added a missing commit for an import.
- Fixed style and unused import issues.
Revision 2 (+786 -42)
Checks run (2 succeeded)