• 
      

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

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

    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.

    Description From Last Updated

    E131 continuation line unaligned for hanging indent

    reviewbotreviewbot

    E131 continuation line unaligned for hanging indent

    reviewbotreviewbot

    I have an important comment here but it seemed more appropriate on your other change. See there.

    daviddavid

    This doesn't seem to be in the argument list.

    daviddavid

    Nor this.

    daviddavid

    Default value here isn't needed and your other similar code doesn't have it.

    daviddavid
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    chipx86
    david
    1. 
        
    2. reviewboard/reviews/detail.py (Diff revision 2)
       
       
      Show all issues

      I have an important comment here but it seemed more appropriate on your other change. See there.

      1. I'll make that change separately from this change, since I'm trying not to introduce reworked collapsing logic here (just moving around where it's all computed).

    3. reviewboard/reviews/detail.py (Diff revision 2)
       
       
       
      Show all issues

      This doesn't seem to be in the argument list.

    4. reviewboard/reviews/detail.py (Diff revision 2)
       
       
       
      Show all issues

      Nor this.

    5. reviewboard/reviews/detail.py (Diff revision 2)
       
       
      Show all issues

      Default value here isn't needed and your other similar code doesn't have it.

    6. 
        
    chipx86
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-3.0.x (eb696a5)