Move review request page entry collapsing logic into the entry itself.

Review Request #9280 — Created Oct. 18, 2017 and submitted — Latest diff uploaded

Information

Review Board
release-3.0.x
a09ff90...

Reviewers

ReviewRequestPageEntry instances were previously told what their
collapse state was, as this was originally calculated in the view. As
this was restructured to allow for page entry type registration and
dynamic updates to the page, the collapsing logic was more closely tied
to each entry.

Entries no longer need to be told their collapsed state, so instead,
entries now calculate it themselves. They have a new
calculate_collapsed method that's called by a collapsed cache
property. These can make use of the new ReviewRequestPageData
association to figure out what the collapsed state should be.

Once set, the collapsed value is not changed for the instance. This
means that instead of other methods (like add_comment) altering the
pre-computed value, their logic is now incorporated into the initial
computation, making for more predictable and testable results.

Function signatures are now more simplified because of this, and
extension authors will be able to make better use of sane defaults for
the collapsing states.

Unit tests have been updated to check all the various collapsing states.

An upcoming change will build upon this to improve the logic we have for
calculating collapse states for reviews and anything with status
updates.

Unit tests pass.

Tested with a large review request containing every type of data used for
collapse states. Verified that the collapse states were consistent before
and after this change.