Move publishError events out of views to models. Clarify PublishError message.

Review Request #7479 — Created July 2, 2015 and submitted

Information

Review Board
release-2.0.x

Reviewers

Move publishError events out of views to models. Clarify PublishError message.

This causes to error handlers for the "Ship It!" button and the Review Dialog
to be triggered.

Simulated a PublishError on the server and verified that alerts popped up after clicking the "Ship It!" button, the "Publish Review" button in the Review dialog, and the "Publish" button in the draft banner for both a review and a reply.

Description From Last Updated

Now that we're passing our own function in as part of the object, we don't have to do the whole …

daviddavid
reviewbot
  1. Tool: Pyflakes
    Ignored Files:
        reviewboard/static/rb/js/views/reviewDialogView.js
        reviewboard/static/rb/js/pages/views/reviewablePageView.js
    
    
    
    Tool: PEP8 Style Checker
    Ignored Files:
        reviewboard/static/rb/js/views/reviewDialogView.js
        reviewboard/static/rb/js/pages/views/reviewablePageView.js
    
    
  2. 
      
david
  1. I think it would be better to put this in RB.DraftReview's publish method (we already have a success handler there that emits a signal).

  2. 
      
MC
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/errors.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/reviewReplyDraftBannerView.js
        reviewboard/static/rb/js/views/draftReviewBannerView.js
        reviewboard/static/rb/js/resources/models/draftReviewModel.js
        reviewboard/static/rb/js/resources/models/reviewReplyModel.js
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/errors.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/reviewReplyDraftBannerView.js
        reviewboard/static/rb/js/views/draftReviewBannerView.js
        reviewboard/static/rb/js/resources/models/draftReviewModel.js
        reviewboard/static/rb/js/resources/models/reviewReplyModel.js
    
    
  2. 
      
brennie
  1. Ship It!
  2. 
      
david
  1. 
      
  2. reviewboard/static/rb/js/resources/models/draftReviewModel.js (Diff revision 2)
     
     
     
     
     
     
     
    Show all issues

    Now that we're passing our own function in as part of the object, we don't have to do the whole bind/undefined thing. Instead, this can just be:

    error: function(model, xhr) {
        model.trigger('publishError', xhr.errorText);
    
        if (_.isFunction(options.error)) {
            options.error.call(context, model, xhr);
        }
    }
    

    Same in the other file.

  3. 
      
MC
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/errors.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/reviewReplyDraftBannerView.js
        reviewboard/static/rb/js/views/draftReviewBannerView.js
        reviewboard/static/rb/js/resources/models/draftReviewModel.js
        reviewboard/static/rb/js/resources/models/reviewReplyModel.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/errors.py
    
    Ignored Files:
        reviewboard/static/rb/js/views/reviewReplyDraftBannerView.js
        reviewboard/static/rb/js/views/draftReviewBannerView.js
        reviewboard/static/rb/js/resources/models/draftReviewModel.js
        reviewboard/static/rb/js/resources/models/reviewReplyModel.js
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
MC
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (f90aa6c)