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 1

This is not the most recent revision of the diff. The latest diff is revision 2. See what's changed.

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.
4c8f69eb77058beb49bb4f3c34b282aa53c7b0f1 David Trowbridge
reviewboard/reviews/signal_handlers.py
reviewboard/reviews/tests/test_signal_handlers.py
Loading...