Fix over-eager deletion with drafts.

Review Request #13905 — Created May 28, 2024 and submitted — Latest diff uploaded

Information

Review Board
release-7.x

Reviewers

When I added change descriptions and diffsets to the draft deletion
handler, I wasn't thinking about how we delete the draft after
publishing it. In that case, we've assigned the change description to
the review request, and assigned the diffset to the history, but we
haven't cleared them from the draft object. We were therefore deleting
the data right after we published it.

This change fixes that up to properly check that those objects are no
longer alive.

Unit tests have been added for this case with both of those as well as
file attachments, which didn't have this same problem because of the way
we calculate the file attachment state.

  • Ran unit tests.
  • Published a new review request that included a diff and saw that my
    diff wasn't immediately deleted.

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Fix over-eager deletion with drafts.
When I added change descriptions and diffsets to the draft deletion handler, I wasn't thinking about how we delete the draft after publishing it. In that case, we've assigned the change description to the review request, and assigned the diffset to the history, but we haven't cleared them from the draft object. We were therefore deleting the data right after we published it. This change fixes that up to properly check that those objects are no longer alive. Unit tests have been added for this case with both of those as well as file attachments, which didn't have this same problem because of the way we calculate the file attachment state. Testing Done: - Ran unit tests. - Published a new review request that included a diff and saw that my diff wasn't immediately deleted.
59a8cb95c50660ade1ba03302d3c9c0e5b8bd46d David Trowbridge
reviewboard/reviews/signal_handlers.py
reviewboard/reviews/tests/test_signal_handlers.py
Loading...