Don't allow publishing empty review

Review Request #10834 — Created Jan. 18, 2020 and updated — Latest diff uploaded

Information

Review Board
release-3.0.x

Reviewers

When making an empty review (i.e., no comment, body top, body bottom,
or Ship It) the review is recognized as a valid review and can be
published. The problem is that when a review is detected as empty,
the code doesn't raise a publish error so the empty review being
published is blocked.

I added a function to detect empty reviews. Once an empty review is
trying to be published, an error is raised and the public state rolls
back to previous state so it doesn't mess up the state when an error
occurs (public state is a bool - when it's true, the review
is considered as published).

Create a new review -> publish -> publish failed.
Create a new review -> give a comment -> delete the comment -> publish -> publish failed.
Create a new review -> give a header -> delete the header -> publish -> publish failed.
Create a new review -> give a footer -> delete the footer -> publish -> publish failed.
Create a new review -> check "Ship-It" -> publish -> publish success.

Changes between revision 1 and 2

orig
1
2
3
4
5
6

Commits

Summary ID Author
Don't allow publishing empty review
6d65c4578d6e219dc4da5e9109133f4450376dec Xiaohui Liu
Delete extra spaces.
6a22f3dd992478d5b6d9647b1837a1698a3c47ce Xiaohui Liu
Don't allow publishing empty review
79a9e95c26d4437434d1cff3a24afac4ac1a62ca Xiaohui Liu
Delete extra spaces.
e302fe5b4d9a93739582169d7ea09379adeec795 Xiaohui Liu
unit tests added
77361f2ccd649efa6c1547c1d4107ab9cc7eb70f Xiaohui Liu
reviewboard/reviews/tests/test_review.py
reviewboard/static/rb/js/resources/models/tests/draftReviewModelTests.js
Loading...