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.

Commits

Files