Changing Review Request Ownership

Review Request #6990 — Created Feb. 27, 2015 and submitted — Latest diff uploaded

Information

Review Board
master
05c1791...

Reviewers

make the ownership changeable on the UI level

Main code describtions:

In builtin_fields.py we change the 'submitter' field to inherit BaseEditableField so that the 'submitter' field will be editable; The override function--record_change_entry disposes what will be showed in change description; Then override the function to render the only one value for a change description string to HTML instead of a list.

In changedescs/models.py we describe the 'new' and 'old' changes in 'submitter' field and render the value to HTML.

Changes in models/review_request_draft.py are to add 'owner' field to override 'submitter' field. Since 'submitter' field is a property attribute of draftreviewrequest, if we change the'submitter' field from property to attribute directly, 'submitter' of older data in the dababase will be null. This will cause troubles.

Changes in reviewboard/reviews/evolutions are about Writing Database Evolutions of adding 'owner' field to the draft table.

In webapi/resources/review_request_draft.py we get the change information of 'submitter' field and set draft.owner if the change is available.

In reviewRequestEditorView.js we make the field can be autocompleted then show in proper format when updated.

In models/reviewRequestEditorModel.js we detect the changes of 'submitter' field in the front end before sending message to the back end. And show the confirm notification only when 'submitter' field was modified.

In models/draftReviewRequestModel.js: parseResourceData we set the 'submitter' info to the data from response message so that we can use it to update the field.

Passed the http://localhost:8000/js-tests/ for the front end.
Passed tests for the back end.

Added tests:

./reviewboard/manage.py test -- reviewboard.webapi.tests.test_review_request_draft:ResourceTests.test_put_publish_with_new_submitter
This test is about wether the feature works to set the submitter field.

reviewRequestEditorModelTests:
Check to set empty value.
Check if set value successfully.
Check if error thrown when set invalid value.

reviewRequestEditorViewTests:
Check confirm notification works before publish.
Check field can be autocomplete.
Check field can edit.
Check save works.
Check value format after update.
Check edit count successfully.

draftReviewRequestModelTests:
Check parse works for 'submitter' field.