• 
      

    Don't delete reply drafts when deleting a body top/bottom field.

    Review Request #10039 — Created June 25, 2018 and submitted — Latest diff uploaded

    Information

    Review Board
    release-3.0.x
    34e96fd...

    Reviewers

    Due to some bad logic, creating an empty comment saving it for the body
    top/bottom replies to a review would trigger the full deletion of a
    draft, possibly losing a lot of work. This happened because the logic
    attempts to delete a comment if its text was set to empty, but when
    replying to a review directly, it would delete the review instead.

    Now the logic only attempts to do a straight deletion if it knows it's
    not replying to the body top/bottom fields. In that case, it simply
    calls _resetState(), which will reset the state for the particular
    field and then triggers the checks to see if the review is now empty.

    Created and saved a reply to a diff comment, and then created a reply to
    a body top field, leaving it blank and hitting OK. Saw that only that
    particular reply disappeared, rather than the draft being discarded as
    before.

    Tested the other direction and verified that the behavior was as expected.

    Cleared out both replies (tried first with the body_top being the last
    one cleared out, and second with the comment being cleared out last) and
    verified the draft disappeared when there was nothing remaining.

    Unit tests pass.