• 
      

    Prevent new resource instances from readying the parentObject.

    Review Request #4046 — Created April 13, 2013 and submitted

    Information

    Review Board
    master

    Reviewers

    Prevent new resource instances from readying the parentObject.
    
    When we destroyed a new object, we checked if the parentObject was
    ready. This wasn't really necessary, since we didn't have a URL we
    needed to destroy or anything. Our destruction was internal only.
    
    By removing the parentObject.ready call in this case, we get faster
    destruction for unsaved/unloaded objects, and we also prevent a problem
    where we may not be in a position to even fetch the parent object.
    
    The case I refer to is the destruction of draft comments on draft
    reviews, when not logged in. I have a fix I'll put out after this, which
    prevents trying to get the draft review if not logged in. In this case,
    we'd error out, which would break the ready() call. We don't even want
    to hit that case for new objects, though. New objects should be
    destroyable without the parent object being fetchable.
    
    As part of this, I've standardized the call to the parent destroy
    function and the success callback to it, so that we make sure to reset
    the state in all cases.
    Tested with my other change, which allowed us to successfully delete
    draft comments when not logged in.
    reviewbot
    1. This is a review from Review Bot.
        Tool: PEP8 Style Checker
        Processed Files:
        Ignored Files:
          reviewboard/static/rb/js/models/tests/reviewReplyModelTests.js
          reviewboard/static/rb/js/models/baseResourceModel.js
      
      
    2. 
        
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed