Register the privacy consent requirements lazily on demand.
Review Request #10071 — Created July 5, 2018 and submitted
Privacy consent requirements were being registered during Review Board's
initialization phase, and then rebuilt and re-registered whenever
settings changed. The problem was that registering
PolicyConsentRequirementduring Review Board initialization would fail
if the database wasn't yet set up. This core problem was addressed in
another change, but still impacted other management commands, and is
really a practice we should aim to avoid.
Djblets now has a new signal for notifying when a registry is
populating, which we're now able to use instead. This means that instead
of registering on startup, we just register when the registry needs us
to, saving startup time and ensuring we don't interfere with any
database setup process.
This also has the benefit of simplifying the logic considerably. We no
longer need to track whether we've previously registered anything, or
deal with forcefully registering consent requirements. We just
unregister old ones and register new ones.
Unit tests pass.
Temporarily reverted an older change for fixing syncdb with initialization,
and verified that the consent registrations no longer trigger breakages with
Tested viewing and changing consent for policy and gravatars, then changing
settings that triggered new consent requirement registrations, and then viewing
the consent again. Saw the new information. Repeated this test several times.