Fix caching bugs with comments in inline review UIs.
Review Request #14555 — Created Aug. 5, 2025 and submitted
When review UIs for binary files are rendered in "inline" mode as part
of the diff viewer, the serialized comments are included in the rendered
fragment (as opposed to comments on regular diff files, which are all
included as part of the main diff viewer page). Our ETag calculation
wasn't taking this into account, which meant that after making changes
to comments (adding, removing, editing), reloading the diff viewer could
show outdated comments coming from the browser cache.This change reworks the fragment view to include all comment timestamps
in the ETag when the filediff in question is binary. We had an existing,
similar example inCommentDiffFragmentsView
that included the latest
timestamp in the ETag, but this is broken in the case where comments are
deleted or edited on a pending review. I've changed that to include the
same behavior of including all comment timestamps rather than just the
latest.A couple new tests have been added to verify the cache response
behavior.
- Ran unit tests.
- Verified that comments on binary files in the diff viewer no longer
presented with outdated browser cache bugs.
Summary | ID |
---|---|
0c5ce38f202beeb5e547164ef1f1c2dcba19cca1 |
Description | From | Last Updated |
---|---|---|
continuation line under-indented for visual indent Column: 21 Error code: E128 |
![]() |
|
I think this should go away. We just raise errors instead of returning a HttpResponse, and we don't have HttpResponse … |
![]() |
|
This is still the same description as the previous test. |
![]() |
|
A preceding r was added here. |
![]() |
|
This should say diff comments instead of just diff |
![]() |
|
We could have a comments variable and set self.comments to that, so that we don't have to keep accessing self.comments … |
![]() |
|
Can we add a "Raises" section in the docs for this. |
![]() |
|
This should go away too. |
![]() |
|
This argument hasn't been added to the function definition, it gets pulled out of kwargs. |
![]() |
|
Can we add a "Raises" section in the docs for this. |
![]() |
|
During deprecation, new arguments must go on the end so that the decorator can do the right thing. It matches … |
|
|
Description needs to be indented 1. |
|
|
Description needs to be indented 1. |
|
|
What do you think about adding a manager method for this, so we can keep these queries in one place? … |
|
|
Might be nicer as: modified_review_ui_class: ( type[ReviewUI[Any, Any, Any]] | None ) = None, |
|
|
Can we say "Return"? "Get" doesn't imply the result, just that it's getting something. |
|
|
This needs a "Version Added" |
![]() |
|
What about super users who can access the comments? |
![]() |
|
Since we're wrapping, this should be one per line. |
|
|
Double-backticks around the parameter name. |
|
|
Missing , optional. |
|
|
Not a new problem, but noticing it now: We're passing arguments in positional form to a localized string, which won't … |
|
|
Double backticks around request. |
|
|
Swap these (alphabetical order). |
|
|
Add double-backticks around request. |
|
|
Can just be 7.1 to match the others. |
|
- Commits:
-
Summary ID dda2c270e1759a02e23b230113cd3053944dc1e8 0f5813e7a0e5cf105cef12135d267d8ea885a22e
Checks run (2 succeeded)

-
Thanks for fixing this :D.
-
I think this should go away. We just raise errors instead of returning a HttpResponse, and we don't have HttpResponse as a return type on the method.
-
-
We could have a
comments
variable and setself.comments
to that, so that we don't have to keep accessingself.comments
every time. -
-
-
-
- Commits:
-
Summary ID 0f5813e7a0e5cf105cef12135d267d8ea885a22e 22833569602b0fef51527d1522dc814c1794a93f
Checks run (2 succeeded)
- Commits:
-
Summary ID 22833569602b0fef51527d1522dc814c1794a93f 5221448f51bb9248e8a61d08d97cd7408791a76c
Checks run (2 succeeded)
-
-
During deprecation, new arguments must go on the end so that the decorator can do the right thing. It matches up the positions of arguments passed to the position of keyword-only arguments in the arg list.
-
-
-
What do you think about adding a manager method for this, so we can keep these queries in one place? Like,
FileAttachmentCommentManager.objects.for_file_attachment()
, taking the attachments and a user.Been thinking lately that if we could consolidate more of our queries, it'd be easier to maintain and update them when working on performance, and ensure unit tests are more comprehensive.
It's not a blocker for this change.
-
-
- Commits:
-
Summary ID 5221448f51bb9248e8a61d08d97cd7408791a76c cc4e986c7d46b049f8372a4d203f413d03dbd9f5
Checks run (2 succeeded)
- Commits:
-
Summary ID cc4e986c7d46b049f8372a4d203f413d03dbd9f5 a5b02dd428d37884c2ac53bd5bba20d451c9fea3