flake8
-
reviewboard/reviews/tests/test_review_ui.py (Diff revision 1)
Review Request #13681 — Created March 29, 2024 and submitted
This change fixes the links for file attachments which are attached to
binary files in a diff. The Review UI implementation was previously just
linking to the file attachment page, but that's a pretty crummy
experience when the comments were made on the diff.This is pretty complex because there are a lot of corner cases. In
particular, we have to deal with three annoying things:
- We sometimes elide the base commit ID or tip commit ID from the URL,
depending on what commits are selected.- When a review request has commit history, the attachment is uploaded
for the commit-specific filediff, and then we do some magic to find
it when the user is viewing the cumulative diff. In this case, we
have to do the opposite and figure out if the user had commented on
the file while viewing the cumulative diff so we can link back to
that rather than the commit range.- When we do that backwards lookup for annoying thing #2, we need to
make sure that we set the anchor to the correct filediff ID.Unit tests have been added to cover all of these corner cases.
Summary | ID |
---|---|
b656e376010e8a741d0b4277b5def441de9b0225 |
Description | From | Last Updated |
---|---|---|
local variable 'upstream_attachment' is assigned to but never used Column: 9 Error code: F841 |
reviewbot | |
'typing.cast' imported but unused Column: 1 Error code: F401 |
reviewbot | |
These should be in alphabetical order. |
chipx86 | |
"For comments file attachments" -> "For file attachment comments" ? |
chipx86 | |
These are missing docs. |
chipx86 | |
We aren't returning anything in this case. |
chipx86 | |
Looks like the line join got broken when wrapping. |
chipx86 | |
We aren't returning anything in this case. |
chipx86 | |
We aren't returning anything in this case. |
chipx86 | |
This is still going through all the logic of constructing an object and setting up deferred attribute values. We should … |
chipx86 | |
This should go in the previous import group. |
chipx86 | |
We can wrap this at a . and beanbag-docutils will do the right thing. Although this is a standard comment … |
chipx86 | |
Let's sort these in alphabetical order. |
chipx86 | |
This should say "get_comment_link_url" instead of "get_comment_thumbnail". |
maubin | |
This is wrong. |
maubin |
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+986 -22) |
Move revision computation into
FileAttachmentComment
so we can use it elsewhere.
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+1202 -56) |
reviewboard/reviews/ui/base.py (Diff revision 3) |
---|
'typing.cast' imported but unused Column: 1 Error code: F401
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 4 (+1206 -54) |
reviewboard/reviews/models/file_attachment_comment.py (Diff revision 4) |
---|
These should be in alphabetical order.
reviewboard/reviews/models/file_attachment_comment.py (Diff revision 4) |
---|
"For comments file attachments" -> "For file attachment comments" ?
reviewboard/reviews/models/file_attachment_comment.py (Diff revision 4) |
---|
We aren't returning anything in this case.
reviewboard/reviews/models/file_attachment_comment.py (Diff revision 4) |
---|
Looks like the line join got broken when wrapping.
reviewboard/reviews/models/file_attachment_comment.py (Diff revision 4) |
---|
We aren't returning anything in this case.
reviewboard/reviews/models/file_attachment_comment.py (Diff revision 4) |
---|
We aren't returning anything in this case.
reviewboard/reviews/models/file_attachment_comment.py (Diff revision 4) |
---|
This is still going through all the logic of constructing an object and setting up deferred attribute values. We should just use
values_list
:last_commit_id = ( modified_diffset.commits .order_by('-pk') .values_list('pk', flat=True) )[0]
This will still only fetch one result, since
values_list
will evaluate on access, and a direct access of an item will evaluate only to the item needed unless the cache is already populated.
reviewboard/reviews/tests/test_review_ui.py (Diff revision 4) |
---|
This should go in the previous import group.
reviewboard/reviews/ui/base.py (Diff revision 4) |
---|
We can wrap this at a
.
andbeanbag-docutils
will do the right thing.Although this is a standard comment and not processed by ReST.
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 5 (+1222 -64) |
reviewboard/reviews/models/file_attachment_comment.py (Diff revision 5) |
---|
This should say "get_comment_link_url" instead of "get_comment_thumbnail".
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 6 (+1224 -64) |