Comment serialization cleanup part 2: Clarify serialization structures.
Review Request #13656 — Created March 21, 2024 and submitted
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.
Summary | ID |
---|---|
8ed7bcfe26b0f4152dab8462a36ef137db433f6a |
Description | From | Last Updated |
---|---|---|
The second argument can be deserialized data to compare. If it's a string, it gets loaded, but we don't need … |
chipx86 | |
Maybe worth just comparing the entire payloads going forward? |
chipx86 | |
Let's use :file: for this. |
chipx86 | |
Let's use :file: for this. |
chipx86 | |
This is missing docs. |
chipx86 | |
We don't normally use the outer parens here. |
chipx86 | |
Should use :file:. |
chipx86 | |
We have the nice new ** embedding in dictionaries now, so we could do: return { **super().serialize_comment(comment), 'x': comment.x, 'y': … |
chipx86 | |
:file: |
chipx86 | |
This should be before any classes/functions. |
chipx86 | |
Version Added? |
chipx86 | |
This should use the standard multi-line comment format. Maybe add a TODO or TODO [some-tag] here? |
chipx86 | |
:file: |
chipx86 | |
:file: |
chipx86 | |
:file: |
chipx86 |
-
-
The second argument can be deserialized data to compare. If it's a string, it gets loaded, but we don't need to provide it as a string.
-
-
-
-
-
-
-
We have the nice new
**
embedding in dictionaries now, so we could do:return { **super().serialize_comment(comment), 'x': comment.x, 'y': comment.y, 'width': comment.w, 'height': comment.h, }
-
-
-
-
-
-
-
- Commits:
-
Summary ID 6c61183d0737a4bdc0e68a2c90917aaebd35db14 8ed7bcfe26b0f4152dab8462a36ef137db433f6a - Diff:
-
Revision 2 (+776 -288)