Fixed link to replying to other replies in the diff viewer

Review Request #7926 — Created Jan. 30, 2016 and submitted

Information

Review Board
release-2.5.x

Reviewers

On the diff page the list of comments doesn't differenciate between
top-level comments and replies to those comments. Because reviewboard
doesn't support replying to a reply of a comment, the "Reply" link on
those reply comments would not work properly. This fix solves that problem
by changing those reply links to reply to their parent comment.

Manual Test:
-Create a comment on a line on the diff viewer page for a review request.

-Reply to that comment.

-Go back to the diff viewer page and click the reply link of
that reply comment.

-Expected result is that it should go to the review page, scroll to,
and open the reply editor for the parent comment of that reply.

-Jasmine js test suite passed
-Reviewboard unit test suite passed
-2 new tests added to the js test suit

Description From Last Updated

Needs a trailing comma after the last entry (we do this so that if we end up adding another entry …

mike_conleymike_conley

Let's call this reply_to_id, for consistency.

chipx86chipx86

This one should be comment-list-reply-action. That will make your queries easier, too.

chipx86chipx86

In our codebase, we only ever have one var statement per function, at the very top, one variable per line. …

chipx86chipx86

This made me notice a typo in the original object. Should be "Test User".

chipx86chipx86

As above, the var should go at the top of this function (with a blank line after it).

chipx86chipx86

Same here.

chipx86chipx86

This should be formatted as: expect(/*...*/) .toContain(/*...*/)

brenniebrennie

Single quotes. Also, this should be formatted as: expect(/*...*/) .toContain(/*...*/);

brenniebrennie

Same here.

brenniebrennie

We don't usually put trailing comments.

brenniebrennie

Since you're doing $commentsList.find(selector) multiple times, it would be better to do: var $replies; editor.set(/*...*/); dlg.open(); $replies = $commentList.find(selector); expect($replies[0].href).toContain(/*...*/); …

brenniebrennie

We use single quotes.

brenniebrennie

Same here.

brenniebrennie

Can also probably build the target string ahead of time, too.

brenniebrennie
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/context.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/commentDialogView.js
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/context.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/commentDialogView.js
    
    
  2. 
      
imadueme
  1. 
      
  2. reviewboard/reviews/context.py (Diff revision 1)
     
     

    This is a test message. Please ignore.

    1. This is a test reply message. Please ignore.

    2. (Gotcha - though, in the future, if you want to do testing stuff, check out http://demo.reviewboard.org)

  3. 
      
chipx86
  1. Something that's important when writing commit/review request descriptions is to tell the reviewer the story of your change. Assume that the person reading it may be reading it 3 years from now, and may have no knowledge of what you did or why. Then go from there.

    The summary should be a clear, concise thing about what you did: "Fixed the link for replying to other replies in the diff viewer."

    Then tell the story in the description of what was wrong before and what you've done to address it. Not all the technical details, but the higher-level stuff.

    See https://www.reviewboard.org/docs/codebase/dev/writing-good-descriptions/ for examples.

  2. 
      
mike_conley
  1. Looking good! Can you please update the bug number in this review request?

  2. reviewboard/reviews/context.py (Diff revision 1)
     
     

    Needs a trailing comma after the last entry (we do this so that if we end up adding another entry to the end of this list, we don't have to add the comma to the previous entry which updates blame on that line.

    Also, I'm not 100% sure, but doesn't this default to None already if no relationship is set? If so, we can probably just rewrite this as:

    ...
    'reply_to': comment.reply_to_id,
    
    1. That's correct, it will default to None.

  3. 
      
chipx86
  1. This is also going to need unit tests that check for the two possibilities: A reply to ID, or a review ID.

    This would live in js/views/tests/commentDialogViewTests.js. You can see where we have a describe('Other published comments list', ...) section, which already does a few things. You'd add new tests that verify the links for both types of comments.

    By having this, we ensure that this can't break down the road without us noticing.

  2. 
      
imadueme
imadueme
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/context.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/commentDialogView.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/context.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/commentDialogView.js
    
    
  2. 
      
chipx86
  1. Almost! The bug number actually isn't useful in either the summary or the description. It should go in the bugs field. That will automatically be placed in the commit message when landing.

    The description should also wrap at 80 characters, like our source code. It's best to compose this in your commit message, using your editor to ensure the proper width, and use that for the review request description. The summary/description in the review request will be used as-is in the commit message.

    1. Also, please don't forget to close the issue I opened in my earlier review - that way. Open issues make reviewers antsy. :)

  2. 
      
imadueme
imadueme
imadueme
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/context.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/tests/commentDialogViewTests.js
        reviewboard/static/rb/js/views/commentDialogView.js
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/context.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/tests/commentDialogViewTests.js
        reviewboard/static/rb/js/views/commentDialogView.js
    
    
  2. 
      
chipx86
  1. 
      
  2. reviewboard/reviews/context.py (Diff revision 3)
     
     

    Let's call this reply_to_id, for consistency.

  3. This one should be comment-list-reply-action. That will make your queries easier, too.

  4. In our codebase, we only ever have one var statement per function, at the very top, one variable per line. So:

    var comment,
        commentReply;
    
  5. This made me notice a typo in the original object. Should be "Test User".

  6. As above, the var should go at the top of this function (with a blank line after it).

  7. 
      
imadueme
imadueme
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/context.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/tests/commentDialogViewTests.js
        reviewboard/static/rb/js/views/commentDialogView.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/context.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/tests/commentDialogViewTests.js
        reviewboard/static/rb/js/views/commentDialogView.js
    
    
  2. 
      
imadueme
imadueme
brennie
  1. 
      
  2. This should be formatted as:

    expect(/*...*/)
        .toContain(/*...*/)
    
  3. Single quotes.

    Also, this should be formatted as:

    expect(/*...*/)
        .toContain(/*...*/);
    
  4. We don't usually put trailing comments.

  5. Since you're doing $commentsList.find(selector) multiple times, it would be better to do:

    var $replies;
    
    editor.set(/*...*/);
    dlg.open();
    
    $replies = $commentList.find(selector);
    
    expect($replies[0].href).toContain(/*...*/);
    expect($replies[1].href).toContain(/*...*/);
    

    We should also probably do:

    expect($replies.length).toEqual(2);
    
  6. We use single quotes.

  7. Can also probably build the target string ahead of time, too.

  8. 
      
imadueme
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/context.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/tests/commentDialogViewTests.js
        reviewboard/static/rb/js/views/commentDialogView.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/context.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/tests/commentDialogViewTests.js
        reviewboard/static/rb/js/views/commentDialogView.js
    
    
  2. 
      
imadueme
david
  1. Ship It!
  2. 
      
imadueme
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.5.x (2224eff)
Loading...