• 
      

    Introduce LocalSite.ALL as a method for querying across all LocalSites.

    Review Request #12328 — Created June 2, 2022 and submitted

    Information

    Review Board
    release-5.0.x

    Reviewers

    The common query methods for review requests, review groups, and
    repositories had one parameter for specifying a LocalSite and another
    (show_all_local_sites) for specifying if the query should be across
    all LocalSites.

    As we begin to add more methods for calculating LocalSite-related
    stats, we have more cases where callers need to be able to provide a
    LocalSite, the global site, or specify "across all sites". Keeping
    this two-parameter approach just makes all this more complicated and
    messy, so this change introduces a new approach.

    There's now a LocalSite.ALL value that represents "across all sites".
    Functions can optionally accept this in order to explicitly request this
    kind of query.

    This is just a simple object, and will fail if being passed into
    queryset filters, which means we won't accidentally break anything if
    passed in. Any function that accepts LocalSite.ALL will need to be
    documented as explicitly supporting it.

    Right now, support is available in ReviewRequestManager,
    ReviewGroupManager, and RepositoryManager query methods. Some of the
    new stat-calculation functions will soon take this as well.

    The old show_all_local_sites flag still works, but will emit a
    deprecation warning. All internal code has been updated to use
    LocalSite.ALL instead.

    All unit tests pass, with no related warnings.

    Summary ID
    Introduce LocalSite.ALL as a method for querying across all LocalSites.
    The common query methods for review requests, review groups, and repositories had one parameter for specifying a `LocalSite` and another (`show_all_local_sites`) for specifying if the query should be across all `LocalSite`s. As we begin to add more methods for calculating `LocalSite`-related stats, we have more cases where callers need to be able to provide a `LocalSite`, the global site, or specify "across all sites". Keeping this two-parameter approach just makes all this more complicated and messy, so this change introduces a new approach. There's now a `LocalSite.ALL` value that represents "across all sites". Functions can optionally accept this in order to explicitly request this kind of query. This is just a simple object, and will fail if being passed into queryset filters, which means we won't accidentally break anything if passed in. Any function that accepts `LocalSite.ALL` will need to be documented as explicitly supporting it. Right now, support is available in `ReviewRequestManager`, `ReviewGroupManager`, and `RepositoryManager` query methods. Some of the new stat-calculation functions will soon take this as well. The old `show_all_local_sites` flag still works, but will emit a deprecation warning. All internal code has been updated to use `LocalSite.ALL` instead.
    593576ba73454d5b592de19658e61b88b29e402b
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-5.0.x (0452b20)