Status API part 3: Refactor entries on review detail page.

Review Request #8339 — Created Aug. 19, 2016 and submitted

Information

Review Board
release-3.0.x
7d15a8f...

Reviewers

The review detail page is huge and ugly and multi-tentacled. This change
attempts to clean things up just a little bit, by creating some classes for the
various types of "entries" (the review and change boxes).

This is primarily code motion, but I did discover an obscure bug while I was
doing this related to default expansion for draft reply comments (the entry
variable was never assigned in that case, leaving it to be whatever it was
before).

There's obviously a ton more that could be done here, but I want to take this
one step at a time.

Verified the appearance of the review detail page with multiple reviews,
replies, and change descriptions. Everything works as it did before.

Description From Last Updated

Does .. seealso: :py:data:`...` work here?

brenniebrennie

Can we call this something like BaseReviewRequestPageEntry? It'll be more clear what it's for when reading other code.

chipx86chipx86

Can you elaborate on this, going into what an "entry" means? There's a lot going on on this page, and …

chipx86chipx86

"JavaScript"

chipx86chipx86

bool

chipx86chipx86

bool

chipx86chipx86

:py:attr: Referenced attributes (or any we want to make public, really) also need to be listed in the class's docstring …

chipx86chipx86

This uses keyword arguments, but the others don't. We should be consistent here in our usage. (I'd say probably go …

chipx86chipx86

Missing period.

chipx86chipx86

Can we use keyword arguments, so this is self-documenting?

chipx86chipx86

Might be nicer to just pull this out into a fieldsets variable first, and then iterate through that.

chipx86chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/detail.py
    
    Ignored Files:
        reviewboard/templates/reviews/review_detail.html
        reviewboard/templates/reviews/boxes/review.html
        reviewboard/templates/reviews/boxes/change.js
        reviewboard/templates/reviews/boxes/review.js
        reviewboard/templates/reviews/boxes/change.html
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/detail.py
    
    Ignored Files:
        reviewboard/templates/reviews/review_detail.html
        reviewboard/templates/reviews/boxes/review.html
        reviewboard/templates/reviews/boxes/change.js
        reviewboard/templates/reviews/boxes/review.js
        reviewboard/templates/reviews/boxes/change.html
    
    
  2. 
      
brennie
  1. 
      
  2. reviewboard/reviews/detail.py (Diff revision 1)
     
     
     
     
    Show all issues

    Does .. seealso: :py:data:`...` work here?

  3. 
      
david
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/detail.py
    
    Ignored Files:
        reviewboard/templates/reviews/review_detail.html
        reviewboard/templates/reviews/boxes/review.html
        reviewboard/templates/reviews/boxes/change.js
        reviewboard/templates/reviews/boxes/review.js
        reviewboard/templates/reviews/boxes/change.html
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/detail.py
    
    Ignored Files:
        reviewboard/templates/reviews/review_detail.html
        reviewboard/templates/reviews/boxes/review.html
        reviewboard/templates/reviews/boxes/change.js
        reviewboard/templates/reviews/boxes/review.js
        reviewboard/templates/reviews/boxes/change.html
    
    
  2. 
      
chipx86
  1. Great cleanup :) I like where this could go.

    Got some comments about naming and docs, but the logic seems fine. Tried going through the collapsing logic and I think it looks good.

    Could the replies end up being moved into the entries, and the "should this be collapsed" logic? I don't care about that for this change, just wondering about planned next steps.

    1. Ideally yes. I think I'm going to come back to that later as necessary.

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

    Can we call this something like BaseReviewRequestPageEntry? It'll be more clear what it's for when reading other code.

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

    Can you elaborate on this, going into what an "entry" means? There's a lot going on on this page, and I want new contributors to be clear on this.

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

    "JavaScript"

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

    :py:attr:

    Referenced attributes (or any we want to make public, really) also need to be listed in the class's docstring under "Attributes:"

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

    This uses keyword arguments, but the others don't. We should be consistent here in our usage. (I'd say probably go with keyword arguments everywhere.)

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

    Missing period.

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

    Can we use keyword arguments, so this is self-documenting?

  9. 
      
david
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/detail.py
    
    Ignored Files:
        reviewboard/templates/reviews/review_detail.html
        reviewboard/templates/reviews/boxes/review.html
        reviewboard/templates/reviews/boxes/change.js
        reviewboard/templates/reviews/boxes/review.js
        reviewboard/templates/reviews/boxes/change.html
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/detail.py
    
    Ignored Files:
        reviewboard/templates/reviews/review_detail.html
        reviewboard/templates/reviews/boxes/review.html
        reviewboard/templates/reviews/boxes/change.js
        reviewboard/templates/reviews/boxes/review.js
        reviewboard/templates/reviews/boxes/change.html
    
    
  2. 
      
chipx86
  1. 
      
  2. reviewboard/reviews/detail.py (Diff revisions 2 - 3)
     
     
    Show all issues

    bool

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

    bool

  4. reviewboard/reviews/detail.py (Diff revisions 2 - 3)
     
     
     
     
    Show all issues

    Might be nicer to just pull this out into a fieldsets variable first, and then iterate through that.

  5. 
      
david
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/detail.py
    
    Ignored Files:
        reviewboard/templates/reviews/review_detail.html
        reviewboard/templates/reviews/boxes/review.html
        reviewboard/templates/reviews/boxes/change.js
        reviewboard/templates/reviews/boxes/review.js
        reviewboard/templates/reviews/boxes/change.html
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/detail.py
    
    Ignored Files:
        reviewboard/templates/reviews/review_detail.html
        reviewboard/templates/reviews/boxes/review.html
        reviewboard/templates/reviews/boxes/change.js
        reviewboard/templates/reviews/boxes/review.js
        reviewboard/templates/reviews/boxes/change.html
    
    
  2. 
      
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (02c0f83)