Convert ReviewRequest to Backbone.js.
Review Request #4051 — Created April 15, 2013 and submitted — Latest diff uploaded
Convert ReviewRequest to Backbone.js. This introduces a new RB.ReviewRequest and a RB.DraftReviewRequest, both based on BaseResource. These are the last resource classes that needed to be converted. RB.ReviewRequest operates on a review request and provides operations like closing a review request, reopening, checking for updates, and creating child objects. It has a 'draft' parameter pointing to a DraftReviewRequest. DraftReviewRequest handles setting of fields on a review request and publishing the draft. All the hacky .cid checks have been removed, meaning we can now rely on new-style objects for resources. Some additional work had to be done to transition our editors over to the new class. These will end up looking nicer when that code is also transitioned to new classes. For now, they operate on some raw data (passing API field names to options.data instead of using attribute names). This is considered temporary.
Unit tests pass. Set every field on a review request to blank and to valid values. Set invalid values for user/group reviewers and saw the error and the field revert to the server value. Set values that had partial items and invalid items for user/group reviewers. Again, we respected the server-side results (which filtered out the bad ones and gave us an error). Closed review requests as submitted, and as discarded. Set close descriptions. Reopened review requests. Published changed review request drafts. Published new review requests. Opened a review request in two tabs. Made a review in one of them. Saw the "<user> has updated the review request" popup in the other. Tested that uploading diffs and file attachments worked. Tested that I could create reviews.