• 
      

    Fix ID collision in comment issue banners when resolving issues.

    Review Request #12437 — Created July 6, 2022 and submitted — Latest diff uploaded

    Information

    Review Board
    release-5.0.x

    Reviewers

    If a review request contains multiple comments of different types but
    with the same IDs (such as a General Comment and a Diff Comment both
    with ID 2), closing one of the comments would result in the other
    comment appearing to close as well. In fact, the comment did not close,
    it merely appeared to.

    This was due to a bad check in CommentIssueBarView. It listened for
    state updates and assumed that if the IDs matched, that was good enough.
    It also needed to consider the comment type.

    In order to do that, we first needed a way to represent the types. We
    had hard-coded strings like 'diff_comments', but nothing formal, and
    no way to get to it from the event handler.

    There's now a CommentIssueManager.CommentTypes mapping of type
    constants to values. The appropriate value is determined and then
    provided when triggering issueStatusChanged. This allows the event
    handler to perform the proper match.

    Unit tests have been updated to check this for each supported comment
    type.

    In the future, we'll want to consider rethinking some of the way this
    works, moving toward a model where we work directly with the comment
    objects (ensuring there's only one object per comment) rather than
    a more broad listener approach (which requires each handler to
    perform these checks).

    Unit tests pass.

    Reproduced the original problem in a new database, and verified that
    this fixes the state and UI collision.

    Commits

    Files