Avoid to submit a non-public draft

Review Request #6856 — Created Jan. 31, 2015 and submitted — Latest diff uploaded

Information

Review Board
master
f510d18...

Reviewers

Fix not dealing with submit action with review_request.py

Add validation to the ReviewRequest model to prevent state transitions to SUBMITTED if the review request is not public.

Then get rid of the "Submit" button in a review request if it's not currently public on the UI level.

Changes have been made on following tests because they just creat a non-public empty draft to submit. This should not be allowed.

./reviewboard/manage.py test -- reviewboard.reviews.tests:ReviewRequestCounterTests.test_closing_closed_requests

I publish the review request first before discard it.

./reviewboard/manage.py test -- reviewboard.reviews.tests:ReviewRequestCounterTests.test_reopen_submitted_draft_requests

I use test_closing_requests instead of test_closing_draft_requests because test_closing_requests can create a public draft instead.

./reviewboard/manage.py test -- reviewboard.reviews.tests:ReviewRequestTests.test_public_with_discard_reopen_submitted

I publish the review request after reopen a discarded request before submit it.

./reviewboard/manage.py test -- reviewboard.notifications.tests:WebHookSignalDispatchTests.test_review_request_reopened

I create a published request instead.

./reviewboard/manage.py test -- reviewboard.notifications.tests:WebHookSignalDispatchTests.test_review_request_closed_submitted

I create a published request instead.