Fixed a bug where "Start Over" in Update Diff creates a new review request.

Review Request #8402 — Created Sept. 17, 2016 and submitted

Information

Review Board
release-2.5.x
fa15150...

Reviewers

Uploading a bad Diff in the UpdateDiff window causes a Start Over window.
When starting over, a valid diff creates a new review instead of updating.

Fixed by removing code that set the review request number to null.
The request number is now properly retained and no new review is created.

Testing done via reaching Start Over message, then uploading a proper diff.
All results ended with the review being properly updated.

Tested invalid, unparsable and empty files to reach the "Start Over" page.
Tested (via modifying the code) to directly land on the "Start Over" page.
Tested uploading multiple incorrect files then a correct file.
Tested with multiple diff files.
Tested both by using the 'Select a diff' option and clicking and dragging.
Tested on both the Update page menu and the "New Review Request" page.
Tested via Jasmine that StartOver doesn't change reviewRequest.
All tests done on Firefox 48.0, Reviewboard 2.5.x and Python2.7.12

Description From Last Updated

A couple comments I'm making on everyone's changes (this is pretty common for the initial review requests): 1) Your Description …

chipx86chipx86

Your testing mentions Review Board 2.6, which isn't a thing. Did you mean 2.5? The branch still lists "master".

chipx86chipx86

This model is also used on the "New Review Request" page. Can you verify that "Start Over" still works correctly …

daviddavid

I don't think this is the right fix. We want defaults for every attribute in the model. It seems more …

chipx86chipx86

One space before function()

mike_conleymike_conley

It would be nice to use " instead of \'

daviddavid

It would be nice to put the .and.callThrough(...) on the next line to keep things close to 80 characters in …

daviddavid

Busted indentation in here, I think.

mike_conleymike_conley

It looks like the first-level things are only indented 3 spaces instead of 4. Please make sure that all indentation …

daviddavid

Can you format this as one variable per line? var reviewRequest, reviewRequestEditor;

daviddavid

This needs to be specified in the var statement above. Otherwise you're creating a new global variable.

daviddavid

When writing ES5, we merge everything into a single var statement, like this: var priorRequest = reviewRequest, model; That said, …

daviddavid

There's an extra blank line here.

daviddavid

Can you undo this change?

daviddavid

This doesn't seem to be testing anything--you assign the priorRequest variable once, and then test it against what you assigned …

daviddavid

Switch quotes around here.

brenniebrennie
david
  1. I think the code looks OK, but I'd like some changes to the commit message/review request description.

    The bug number should be listed in the "Bugs" field, not the summary or description. The summary should be a single line that describes the change (such as "Fix a bug when clicking "Start Over" in the "Update Diff" dialog." The description should be a longer summary of what the problem was and how you solved it (so that we don't need to open the bug tracker to know what the change was about).

    See https://www.reviewboard.org/docs/codebase/dev/writing-good-descriptions/ for a more complete explanation of what we look for in these, along with examples.

  2. Show all issues

    This model is also used on the "New Review Request" page. Can you verify that "Start Over" still works correctly there?

  3. 
      
CO
CO
chipx86
  1. 
      
  2. Show all issues

    I don't think this is the right fix. We want defaults for every attribute in the model. It seems more like the dialog has the proper state initially, but some state is missing when clicking Start Over. That should be fixed.

    A unit test will need to be written for the resulting fix, to ensure that the resulting state is correct after clicking Start Over.

    1. Sorry! I misread the code at the time. I think this looks correct to me.

      For the unit test, you'll need to create an uploadDiffModelTests.js under rb/js/models/tests/, which would set up a test ensuring that a call to startOver does not change reviewRequest. You can look at other tests for examples on structure.

  3. 
      
chipx86
  1. 
      
  2. Show all issues

    A couple comments I'm making on everyone's changes (this is pretty common for the initial review requests):

    1) Your Description and Testing Done should wrap at around 75 characters on each line. This helps when we turn these into commits, since Git commits should usually be no more than around 75 characters per line. This applies to the summary as well (which I know can be hard, and it's okay if this goes up to 79). A good way to ensure this is to make sure your editor is set to wrap lines at 75 characters when editing a git commit message.

    2) The Summary should be more explicit. It reads that a bug caused "Start Over" to be clicked in "Update Diff," which isn't what you meant. Something better might be: Fixed a bug where "Start Over" in Update Diff creates a new review request.

  3. 
      
CO
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/staticbundles.py
    
    Ignored Files:
        reviewboard/static/rb/js/models/uploadDiffModel.js
        reviewboard/static/rb/js/models/tests/uploadDiffModelTests.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/staticbundles.py
    
    Ignored Files:
        reviewboard/static/rb/js/models/uploadDiffModel.js
        reviewboard/static/rb/js/models/tests/uploadDiffModelTests.js
    
    
  2. 
      
chipx86
  1. 
      
  2. Show all issues

    Your testing mentions Review Board 2.6, which isn't a thing. Did you mean 2.5?

    The branch still lists "master".

  3. 
      
CO
mike_conley
  1. 
      
  2. Show all issues

    One space before function()

  3. Show all issues

    Busted indentation in here, I think.

  4. 
      
david
  1. Can you rebase this change onto release-2.5.x?

    1. Someone told me to leave it on 3.0.x and they would tell me if there were problems. Should I rebase anyways?

    2. Hmm. Who was that?

    3. I think it was Barret.

    4. Given that the bug was reported against 2.5.x, and that's our current stable release, that's where we should fix it.

    5. New feature development should happen on release-3.0.x or master.

  2. Show all issues

    It would be nice to use " instead of \'

  3. Show all issues

    It would be nice to put the .and.callThrough(...) on the next line to keep things close to 80 characters in width.

  4. 
      
CO
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/staticbundles.py
    
    Ignored Files:
        reviewboard/static/rb/js/models/uploadDiffModel.js
        reviewboard/static/rb/js/models/tests/uploadDiffModelTests.js
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/staticbundles.py
    
    Ignored Files:
        reviewboard/static/rb/js/models/uploadDiffModel.js
        reviewboard/static/rb/js/models/tests/uploadDiffModelTests.js
    
    
  2. 
      
david
  1. 
      
  2. Show all issues

    It looks like the first-level things are only indented 3 spaces instead of 4. Please make sure that all indentation are multiples of 4.

  3. Show all issues

    Can you format this as one variable per line?

    var reviewRequest,
        reviewRequestEditor;
    
  4. Show all issues

    This needs to be specified in the var statement above. Otherwise you're creating a new global variable.

  5. Show all issues

    When writing ES5, we merge everything into a single var statement, like this:

    var priorRequest = reviewRequest,
        model;
    

    That said, it probably makes sense to define model inline in the call-through function (var model = options.model;) rather than here in the containing function.

  6. Show all issues

    There's an extra blank line here.

  7. reviewboard/staticbundles.py (Diff revision 3)
     
     
    Show all issues

    Can you undo this change?

  8. 
      
CO
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/staticbundles.py
    
    Ignored Files:
        reviewboard/static/rb/js/models/uploadDiffModel.js
        reviewboard/static/rb/js/models/tests/uploadDiffModelTests.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/staticbundles.py
    
    Ignored Files:
        reviewboard/static/rb/js/models/uploadDiffModel.js
        reviewboard/static/rb/js/models/tests/uploadDiffModelTests.js
    
    
  2. 
      
david
  1. 
      
  2. Show all issues

    This doesn't seem to be testing anything--you assign the priorRequest variable once, and then test it against what you assigned to it. That can never fail.

    I think what you ought to be checking is expect(model.get('reviewRequest').toBe(reviewRequest)

    1. Thanks for pointing this out David. It turns out that the entire function wasn't doing what I was supposed to at all and because of that line it was returning true when run. I've properly rewritten the function to work.

  3. 
      
CO
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/staticbundles.py
    
    Ignored Files:
        reviewboard/static/rb/js/models/uploadDiffModel.js
        reviewboard/static/rb/js/models/tests/uploadDiffModelTests.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/staticbundles.py
    
    Ignored Files:
        reviewboard/static/rb/js/models/uploadDiffModel.js
        reviewboard/static/rb/js/models/tests/uploadDiffModelTests.js
    
    
  2. 
      
brennie
  1. 
      
  2. Show all issues

    Switch quotes around here.

  3. 
      
CO
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/staticbundles.py
    
    Ignored Files:
        reviewboard/static/rb/js/models/uploadDiffModel.js
        reviewboard/static/rb/js/models/tests/uploadDiffModelTests.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/staticbundles.py
    
    Ignored Files:
        reviewboard/static/rb/js/models/uploadDiffModel.js
        reviewboard/static/rb/js/models/tests/uploadDiffModelTests.js
    
    
  2. 
      
CO
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.5.x (33ae429)
Loading...