Improve posting reviews to chat services, and fix a crash on empty reviews.
Review Request #12698 — Created Oct. 25, 2022 and submitted — Latest diff uploaded
When a new review was posted without body_top text and no comment, we
fail to set thebody
variable, causing a crash.While the crash is harmless, it does cause spurious issues in the logs.
This change fixes this, and improves the overall behavior in two ways:
1) If the body_top is "Ship It!", we now fall back to the first comment
(if available), rather than an empty string for the text.2) If a comment is not available, it will now fall back to
body_bottom
,
which wasn't being considered before.
Unit tests pass. The new tests previously exhibited the behavior reported
by a customer.