• 
      

    Comment serialization cleanup part 2: Clarify serialization structures.

    Review Request #13656 — Created March 21, 2024 and submitted — Latest diff uploaded

    Information

    Review Board
    release-7.x

    Reviewers

    This is part 2 of the serialization cleanup. In this change, we now have
    matching structures for serialized comments in Python (defined in the
    Review UI files) and JavaScript (defined in the commentData.ts file).
    These are fully documented and include cross-references to ensure that
    we keep them in sync.

    This also makes the serialization stage within the Review UIs more
    consistent. One of the giant warts we've had is that the basic ReviewUI
    implementation would serialize the comments as a list of dicts, and then
    our subclasses would serialize them as a dict, where the key was some
    logical grouping (such as x/y/width/height for region comments, or
    line/span for text comments) and the value was a list of serialized
    comments for that region. We now always serialize to the dict form, and
    the base ReviewUI will just use indices for the key and single-value
    lists for the values.

    A new method has been added to the base ReviewUI to facilitate this, and
    just filters and yields the comments. Subclasses can then use this and
    sort them however they like. Using this new method fixes a bug in the
    TextBasedReviewUI where we weren't doing filtering, and draft comments
    from other users could show up when they shouldn't.

    Ran js-tests.

    Commits

    Files