MozReview: 'maybeSave' unpublished comments within dropdown dialog (
Bug 1291628). r?smacleod
MozReview-Commit-ID: 7sMNZ3YfWRL
--- a/reviewboard/reviewboard/static/rb/js/views/draftReviewBannerView_mozreview.js
+++ b/reviewboard/reviewboard/static/rb/js/views/draftReviewBannerView_mozreview.js
@@ -97,17 +97,19 @@ RB.DraftReviewBannerView = Backbone.View
* means that we might miss out on some teardown that was
* scheduled. We defer changing the location until the next tick
* of the event loop to let any teardown occur.
*/
_.defer(_.bind(function() {
// MozReview: Whacks <form> elements left over from the RDV
// Important so that browser's "Are you sure you want to leave
// this page" confirmation doesn't pop up.
- this._RDVInstance.close();
+ if(this._RDVInstance) {
+ this._RDVInstance.close();
+ }
window.location = this.model.get('parentObject').get('reviewURL');
}, this));
}, this);
},
/*
* Handler for the Edit Review button.
@@ -170,20 +172,26 @@ RB.DraftReviewBannerView = Backbone.View
},
/*
* Handler for the Publish button.
*
* Publishes the review.
*/
_onPublishClicked: function() {
+ if(this._RDVInstance) {
+ this._RDVInstance._saveReview(true);
+ }
+ else {
this.model.publish({
- attrs: ['public']
+ attrs: ['public']
});
- return false;
+ }
+
+ return false;
},
/*
* Handler for the Discard button.
*
* Prompts the user to confirm that they want the review discarded.
* If they confirm, the review will be discarded.
*/