Move review request page entry collapsing logic into the entry itself.
Review Request #9280 — Created Oct. 18, 2017 and submitted
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 acollapsed
cache
property. These can make use of the newReviewRequestPageData
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 (likeadd_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.
Description | From | Last Updated |
---|---|---|
E131 continuation line unaligned for hanging indent |
reviewbot | |
E131 continuation line unaligned for hanging indent |
reviewbot | |
I have an important comment here but it seemed more appropriate on your other change. See there. |
david | |
This doesn't seem to be in the argument list. |
david | |
Nor this. |
david | |
Default value here isn't needed and your other similar code doesn't have it. |
david |
- Change Summary:
-
- Updated the default collapsing logic for entries to consider the last updated timestamp instead of the added timestamp.
- Updated for Review Bot complaints.
- Commit:
-
41deab072ee69aa30fd197ada711a759730dc592bcb3b664cefdf7cc44618d6672d6a326c5fc9d41