JS resources now use functions for defaults

Review Request #7381 — Created June 4, 2015 and submitted

Information

Review Board
release-2.0.x
11da7d2...

Reviewers

Previously, the RB.BaseResource model was using an object literal for
its defaults, but its default value for extra data was an empty object.
This could possibly result in shared state if a resource did not return
an extra_data JSON field, so the defaults property has been changed
into a function to avoid this.

All child resources of RB.BaseResource have been modified to use a
function instead of an attribute for defaults and to correctly invoke
the parent class's definition of defaults.

Ran JS tests.

Description From Last Updated

The line is now too long. I suspect there are others, but I can't easily check here (we really need …

chipx86chipx86

Not sure we need to bother with the .call(this), since the context doesn't actually matter in any of these (nor …

chipx86chipx86

This is over-indented.

chipx86chipx86
reviewbot
  1. Tool: PEP8 Style Checker
    Ignored Files:
        reviewboard/static/rb/js/resources/models/baseResourceModel.js
    
    
    
    Tool: Pyflakes
    Ignored Files:
        reviewboard/static/rb/js/resources/models/baseResourceModel.js
    
    
  2. 
      
david
  1. Testing done?

  2. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Ignored Files:
        reviewboard/static/rb/js/resources/models/reviewGroupModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentModel.js
        reviewboard/static/rb/js/resources/models/reviewRequestModel.js
        reviewboard/static/rb/js/resources/models/diffCommentModel.js
        reviewboard/static/rb/js/resources/models/diffModel.js
        reviewboard/static/rb/js/resources/models/fileDiffModel.js
        reviewboard/static/rb/js/resources/models/reviewReplyModel.js
        reviewboard/static/rb/js/resources/models/screenshotCommentModel.js
        reviewboard/static/rb/js/resources/models/baseResourceModel.js
        reviewboard/static/rb/js/resources/models/baseCommentModel.js
        reviewboard/static/rb/js/resources/models/draftReviewRequestModel.js
        reviewboard/static/rb/js/resources/models/screenshotModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentCommentModel.js
        reviewboard/static/rb/js/resources/models/defaultReviewerModel.js
        reviewboard/static/rb/js/resources/models/baseCommentReplyModel.js
        reviewboard/static/rb/js/resources/models/validateDiffModel.js
        reviewboard/static/rb/js/resources/models/repositoryModel.js
        reviewboard/static/rb/js/resources/models/reviewModel.js
    
    
    
    Tool: PEP8 Style Checker
    Ignored Files:
        reviewboard/static/rb/js/resources/models/reviewGroupModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentModel.js
        reviewboard/static/rb/js/resources/models/reviewRequestModel.js
        reviewboard/static/rb/js/resources/models/diffCommentModel.js
        reviewboard/static/rb/js/resources/models/diffModel.js
        reviewboard/static/rb/js/resources/models/fileDiffModel.js
        reviewboard/static/rb/js/resources/models/reviewReplyModel.js
        reviewboard/static/rb/js/resources/models/screenshotCommentModel.js
        reviewboard/static/rb/js/resources/models/baseResourceModel.js
        reviewboard/static/rb/js/resources/models/baseCommentModel.js
        reviewboard/static/rb/js/resources/models/draftReviewRequestModel.js
        reviewboard/static/rb/js/resources/models/screenshotModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentCommentModel.js
        reviewboard/static/rb/js/resources/models/defaultReviewerModel.js
        reviewboard/static/rb/js/resources/models/baseCommentReplyModel.js
        reviewboard/static/rb/js/resources/models/validateDiffModel.js
        reviewboard/static/rb/js/resources/models/repositoryModel.js
        reviewboard/static/rb/js/resources/models/reviewModel.js
    
    
  2. 
      
brennie
david
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. Show all issues

    The line is now too long.

    I suspect there are others, but I can't easily check here (we really need that feature).

  3. 
      
chipx86
  1. 
      
  2. Show all issues

    Not sure we need to bother with the .call(this), since the context doesn't actually matter in any of these (nor should they, as the defaults functions shouldn't assume any information on the instance). (Doesn't hurt, though, and I can be convinced otherwise, but worth bringing up.)

  3. Show all issues

    This is over-indented.

  4. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Ignored Files:
        reviewboard/static/rb/js/resources/models/reviewGroupModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentModel.js
        reviewboard/static/rb/js/resources/models/reviewRequestModel.js
        reviewboard/static/rb/js/resources/models/diffCommentModel.js
        reviewboard/static/rb/js/resources/models/diffModel.js
        reviewboard/static/rb/js/resources/models/fileDiffModel.js
        reviewboard/static/rb/js/resources/models/reviewReplyModel.js
        reviewboard/static/rb/js/resources/models/screenshotCommentModel.js
        reviewboard/static/rb/js/resources/models/baseResourceModel.js
        reviewboard/static/rb/js/resources/models/baseCommentModel.js
        reviewboard/static/rb/js/resources/models/draftReviewRequestModel.js
        reviewboard/static/rb/js/resources/models/screenshotModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentCommentModel.js
        reviewboard/static/rb/js/resources/models/defaultReviewerModel.js
        reviewboard/static/rb/js/resources/models/baseCommentReplyModel.js
        reviewboard/static/rb/js/resources/models/validateDiffModel.js
        reviewboard/static/rb/js/resources/models/repositoryModel.js
        reviewboard/static/rb/js/resources/models/reviewModel.js
    
    
    
    Tool: PEP8 Style Checker
    Ignored Files:
        reviewboard/static/rb/js/resources/models/reviewGroupModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentModel.js
        reviewboard/static/rb/js/resources/models/reviewRequestModel.js
        reviewboard/static/rb/js/resources/models/diffCommentModel.js
        reviewboard/static/rb/js/resources/models/diffModel.js
        reviewboard/static/rb/js/resources/models/fileDiffModel.js
        reviewboard/static/rb/js/resources/models/reviewReplyModel.js
        reviewboard/static/rb/js/resources/models/screenshotCommentModel.js
        reviewboard/static/rb/js/resources/models/baseResourceModel.js
        reviewboard/static/rb/js/resources/models/baseCommentModel.js
        reviewboard/static/rb/js/resources/models/draftReviewRequestModel.js
        reviewboard/static/rb/js/resources/models/screenshotModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentCommentModel.js
        reviewboard/static/rb/js/resources/models/defaultReviewerModel.js
        reviewboard/static/rb/js/resources/models/baseCommentReplyModel.js
        reviewboard/static/rb/js/resources/models/validateDiffModel.js
        reviewboard/static/rb/js/resources/models/repositoryModel.js
        reviewboard/static/rb/js/resources/models/reviewModel.js
    
    
  2. 
      
brennie
reviewbot
  1. Tool: PEP8 Style Checker
    Ignored Files:
        reviewboard/static/rb/js/resources/models/reviewGroupModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentModel.js
        reviewboard/static/rb/js/resources/models/reviewRequestModel.js
        reviewboard/static/rb/js/resources/models/diffCommentModel.js
        reviewboard/static/rb/js/resources/models/diffModel.js
        reviewboard/static/rb/js/resources/models/fileDiffModel.js
        reviewboard/static/rb/js/resources/models/reviewReplyModel.js
        reviewboard/static/rb/js/resources/models/screenshotCommentModel.js
        reviewboard/static/rb/js/resources/models/baseResourceModel.js
        reviewboard/static/rb/js/resources/models/baseCommentModel.js
        reviewboard/static/rb/js/resources/models/draftReviewRequestModel.js
        reviewboard/static/rb/js/resources/models/screenshotModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentCommentModel.js
        reviewboard/static/rb/js/resources/models/defaultReviewerModel.js
        reviewboard/static/rb/js/resources/models/baseCommentReplyModel.js
        reviewboard/static/rb/js/resources/models/validateDiffModel.js
        reviewboard/static/rb/js/resources/models/repositoryModel.js
        reviewboard/static/rb/js/resources/models/reviewModel.js
    
    
    
    Tool: Pyflakes
    Ignored Files:
        reviewboard/static/rb/js/resources/models/reviewGroupModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentModel.js
        reviewboard/static/rb/js/resources/models/reviewRequestModel.js
        reviewboard/static/rb/js/resources/models/diffCommentModel.js
        reviewboard/static/rb/js/resources/models/diffModel.js
        reviewboard/static/rb/js/resources/models/fileDiffModel.js
        reviewboard/static/rb/js/resources/models/reviewReplyModel.js
        reviewboard/static/rb/js/resources/models/screenshotCommentModel.js
        reviewboard/static/rb/js/resources/models/baseResourceModel.js
        reviewboard/static/rb/js/resources/models/baseCommentModel.js
        reviewboard/static/rb/js/resources/models/draftReviewRequestModel.js
        reviewboard/static/rb/js/resources/models/screenshotModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentCommentModel.js
        reviewboard/static/rb/js/resources/models/defaultReviewerModel.js
        reviewboard/static/rb/js/resources/models/baseCommentReplyModel.js
        reviewboard/static/rb/js/resources/models/validateDiffModel.js
        reviewboard/static/rb/js/resources/models/repositoryModel.js
        reviewboard/static/rb/js/resources/models/reviewModel.js
    
    
  2. 
      
brennie
reviewbot
  1. Tool: PEP8 Style Checker
    Ignored Files:
        reviewboard/static/rb/js/resources/models/reviewGroupModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentModel.js
        reviewboard/static/rb/js/resources/models/reviewRequestModel.js
        reviewboard/static/rb/js/resources/models/diffCommentModel.js
        reviewboard/static/rb/js/resources/models/diffModel.js
        reviewboard/static/rb/js/resources/models/fileDiffModel.js
        reviewboard/static/rb/js/resources/models/reviewReplyModel.js
        reviewboard/static/rb/js/resources/models/screenshotCommentModel.js
        reviewboard/static/rb/js/resources/models/baseResourceModel.js
        reviewboard/static/rb/js/resources/models/baseCommentModel.js
        reviewboard/static/rb/js/resources/models/draftReviewRequestModel.js
        reviewboard/static/rb/js/resources/models/screenshotModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentCommentModel.js
        reviewboard/static/rb/js/resources/models/defaultReviewerModel.js
        reviewboard/static/rb/js/resources/models/baseCommentReplyModel.js
        reviewboard/static/rb/js/resources/models/validateDiffModel.js
        reviewboard/static/rb/js/resources/models/repositoryModel.js
        reviewboard/static/rb/js/resources/models/reviewModel.js
    
    
    
    Tool: Pyflakes
    Ignored Files:
        reviewboard/static/rb/js/resources/models/reviewGroupModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentModel.js
        reviewboard/static/rb/js/resources/models/reviewRequestModel.js
        reviewboard/static/rb/js/resources/models/diffCommentModel.js
        reviewboard/static/rb/js/resources/models/diffModel.js
        reviewboard/static/rb/js/resources/models/fileDiffModel.js
        reviewboard/static/rb/js/resources/models/reviewReplyModel.js
        reviewboard/static/rb/js/resources/models/screenshotCommentModel.js
        reviewboard/static/rb/js/resources/models/baseResourceModel.js
        reviewboard/static/rb/js/resources/models/baseCommentModel.js
        reviewboard/static/rb/js/resources/models/draftReviewRequestModel.js
        reviewboard/static/rb/js/resources/models/screenshotModel.js
        reviewboard/static/rb/js/resources/models/fileAttachmentCommentModel.js
        reviewboard/static/rb/js/resources/models/defaultReviewerModel.js
        reviewboard/static/rb/js/resources/models/baseCommentReplyModel.js
        reviewboard/static/rb/js/resources/models/validateDiffModel.js
        reviewboard/static/rb/js/resources/models/repositoryModel.js
        reviewboard/static/rb/js/resources/models/reviewModel.js
    
    
  2. 
      
chipx86
  1. Ship It!
  2. 
      
brennie
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (e73dc19)