Move line commenting and chunk selection functionality into DiffReviewerView.

Review Request #4248 — Created June 18, 2013 and submitted

Information

Review Board
master

Reviewers

Move line commenting and chunk selection functionality into DiffReviewerView.

The majority of code that lived in $.fn.diffFile has been moved into
the new reviewable.

All the code that handles line selection is in a CommentDiffSelector
object, which listens for events on the diff reviewable's element.
This keeps the main reviewable much cleaner and easier to work with.

This also brings back the ghost comment flag, which disappeared in 1.7 (due to
a CSS rule change). That'll probably get backported to 1.7.
Tested commenting on single lines.

Tested commenting across multiple lines.

Tested clicking on comments.

Tested expanding comments.

Tested clicking on chunks, causing highlights.

Tested anchors to lines in the diff viewer.

Saw the ghost flag.
Description From Last Updated

Why not just assign RB.scrollToAnchor above and update things in this file to use that?

daviddavid

It'll be shorter if you put all args on the second line.

daviddavid

There's a lot of explicit null checking for this variable, where I think truthiness works just as well, and would …

daviddavid

When conditionals line up like this, I find it incredibly hard to tell where the conditional ends and the block …

daviddavid

Why did you change this? If it's no longer necessary, can you remove its definition in reviews/views.py?

daviddavid
david
  1. 
      
  2. reviewboard/static/rb/js/diffviewer.js (Diff revision 1)
     
     
    Show all issues
    Why not just assign RB.scrollToAnchor above and update things in this file to use that?
    1. To reduce code churn. This is moving completely in my upcoming change, so I didn't want to spend much time on it.
  3. Show all issues
    It'll be shorter if you put all args on the second line.
    1. This is going to change a bit a couple changes from now. I can change it for this change, but it's short-lived.
  4. Show all issues
    There's a lot of explicit null checking for this variable, where I think truthiness works just as well, and would be more readable. Others too, but _$begin seems to be the worst offender.
  5. Show all issues
    When conditionals line up like this, I find it incredibly hard to tell where the conditional ends and the block begins. How would you feel about either using the && at the beginning of the second line of the conditional, or putting a blank line at the top of the block?
    1. Sure, I'll do something about it.
  6. Show all issues
    Why did you change this? If it's no longer necessary, can you remove its definition in reviews/views.py?
  7. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed