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

Information

rbintegrations
release-2.0.x

Reviewers

When a new review was posted without body_top text and no comment, we
fail to set the body 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.

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Improve posting reviews to chat services, and fix a crash on empty reviews.
When a new review was posted without body_top text and no comment, we fail to set the `body` 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, then it now falls back to `body_bottom`, which wasn't being considered before.
ec9bb60fd579ef86de7813e07c41f7091040dfee Christian Hammond
rbintegrations/basechat/integration.py
rbintegrations/discord/tests.py
rbintegrations/mattermost/tests.py
rbintegrations/slack/tests.py
Loading...