Fix openIssue checkbox set to default when reloading the page with explicitly set value

Review Request #6867 — Created Feb. 1, 2015 and submitted

Information

Review Board
release-2.0.x
29720ca...

Reviewers

In the "View Diff" page, click one line in diff content to open one comment dialog
and create one comment WITHOUT issue opened. And reload that view diff page, click
the flag of that comment we just created, the "IssueOpened" checkbox is checked in
the dialog. Close it and reopen it again, the checked status is OK.

Since the status setting is missed, we set the issueOpened status and issued status
when creating the draftcomment in the comment block.

Added a unit test, which passes along with all other tests.

Tested with a commentEditor which contains a comment whose 'loaded' attribute and
'issueOpened' attribute are false and the default setting is true. Previously, the
editor's 'openIssue' attribute is true. After, the attribute will set to user's setting
with the patch.

Test for some cases, all passed.

Description From Last Updated

Let's break up this long line - maybe after comment.text,, like: this.ensureDraftComment(comment.comment_id, comment.text, comment.issue_opened, comment.issue_status);

mike_conleymike_conley

We might want to check for the presence of issue_opened and issue_status. We seem to do the same for text, …

mike_conleymike_conley

Can you remove the trailing whitespace on this line? (Any trailing whitespace is always highlighted in red in the diff …

anselinaanselina

If w're modifying this function signature, maybe instead we want to just pass a dictionary of attributes to set. We …

chipx86chipx86

Blank line between these.

chipx86chipx86

Blank line between these.

chipx86chipx86

In JavaScript, you actually want to use ===. That is a strict comparison, whereas == will try casting to equivalent …

chipx86chipx86

var statements should go at the top of hte function.

chipx86chipx86

This should happen at the top of the function (before the // We load in ... comment). We define all …

daviddavid
reviewbot
  1. Tool: Pyflakes
    Ignored Files:
        reviewboard/static/rb/js/models/abstractCommentBlockModel.js
        reviewboard/static/rb/js/models/commentEditorModel.js
        reviewboard/static/rb/js/models/tests/commentEditorModelTests.js
    
    
    
    Tool: PEP8 Style Checker
    Ignored Files:
        reviewboard/static/rb/js/models/abstractCommentBlockModel.js
        reviewboard/static/rb/js/models/commentEditorModel.js
        reviewboard/static/rb/js/models/tests/commentEditorModelTests.js
    
    
  2. 
      
MI
mike_conley
  1. 
      
  2. Show all issues

    Let's break up this long line - maybe after comment.text,, like:

    this.ensureDraftComment(comment.comment_id, comment.text,
                            comment.issue_opened, comment.issue_status);
    
  3. Show all issues

    We might want to check for the presence of issue_opened and issue_status. We seem to do the same for text, so might as well follow the pattern.

    1. I think issueOpended may not need if statement since it can be null. Whether set it or not, it has no influence.

  4. 
      
MI
mike_conley
  1. Hey Mingyi, just a reminder to address the issues that I opened. Also, please mark them "Fixed" as you address them. Thanks!

  2. 
      
chipx86
  1. Make sure to read through the guide on writing summaries and descriptions :) - https://www.reviewboard.org/docs/codebase/dev/writing-good-descriptions/

  2. 
      
MI
reviewbot
  1. Tool: PEP8 Style Checker
    Ignored Files:
        reviewboard/static/rb/js/models/abstractCommentBlockModel.js
        reviewboard/static/rb/js/models/commentEditorModel.js
        reviewboard/static/rb/js/models/tests/commentEditorModelTests.js
    
    
    
    Tool: Pyflakes
    Ignored Files:
        reviewboard/static/rb/js/models/abstractCommentBlockModel.js
        reviewboard/static/rb/js/models/commentEditorModel.js
        reviewboard/static/rb/js/models/tests/commentEditorModelTests.js
    
    
  2. 
      
anselina
  1. 
      
  2. Show all issues

    Can you remove the trailing whitespace on this line? (Any trailing whitespace is always highlighted in red in the diff viewer.)

  3. 
      
MI
reviewbot
  1. Tool: Pyflakes
    Ignored Files:
        reviewboard/static/rb/js/models/abstractCommentBlockModel.js
        reviewboard/static/rb/js/models/commentEditorModel.js
        reviewboard/static/rb/js/models/tests/commentEditorModelTests.js
    
    
    
    Tool: PEP8 Style Checker
    Ignored Files:
        reviewboard/static/rb/js/models/abstractCommentBlockModel.js
        reviewboard/static/rb/js/models/commentEditorModel.js
        reviewboard/static/rb/js/models/tests/commentEditorModelTests.js
    
    
  2. 
      
david
  1. Can you put the bug number into the "Bugs" field on the right-hand side?

  2. 
      
chipx86
  1. 
      
  2. Show all issues

    If w're modifying this function signature, maybe instead we want to just pass a dictionary of attributes to set. We can then just call comment.set(attrs); later.

  3. Show all issues

    Blank line between these.

  4. Show all issues

    Blank line between these.

  5. Show all issues

    In JavaScript, you actually want to use ===. That is a strict comparison, whereas == will try casting to equivalent types.

  6. Show all issues

    var statements should go at the top of hte function.

  7. 
      
MI
reviewbot
  1. Tool: Pyflakes
    Ignored Files:
        reviewboard/static/rb/js/models/abstractCommentBlockModel.js
        reviewboard/static/rb/js/models/commentEditorModel.js
        reviewboard/static/rb/js/models/tests/commentEditorModelTests.js
    
    
    
    Tool: PEP8 Style Checker
    Ignored Files:
        reviewboard/static/rb/js/models/abstractCommentBlockModel.js
        reviewboard/static/rb/js/models/commentEditorModel.js
        reviewboard/static/rb/js/models/tests/commentEditorModelTests.js
    
    
  2. 
      
david
  1. 
      
  2. Show all issues

    This should happen at the top of the function (before the // We load in ... comment). We define all variables at the top because javascript will hoist their definitions up there anyway, so it makes it less error-prone to read that way.

    1. Is there any docuement about JavaScript code conventions in rb?

    2. Not explicitly, but if you install the "jshint" tool, you can run it on your code and it will catch most of these.

      There's some work to get jshint running on Review Bot but it's not quite there yet.

    3. Got it. Thanks :)

  3. 
      
MI
reviewbot
  1. Tool: Pyflakes
    Ignored Files:
        reviewboard/static/rb/js/models/abstractCommentBlockModel.js
        reviewboard/static/rb/js/models/commentEditorModel.js
        reviewboard/static/rb/js/models/tests/commentEditorModelTests.js
    
    
    
    Tool: PEP8 Style Checker
    Ignored Files:
        reviewboard/static/rb/js/models/abstractCommentBlockModel.js
        reviewboard/static/rb/js/models/commentEditorModel.js
        reviewboard/static/rb/js/models/tests/commentEditorModelTests.js
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
MI
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (8a4bc09)
Loading...