Refactor RB.UploadAttachmentView to extend RB.DialogView
Review Request #10884 — Created Feb. 5, 2020 and submitted
This review request refactors
RB.UploadAttachmentView
to extendRB.DialogView
as opposed to calling theRB.DialogView
constructor andmodalBox
directly.
The change involves extending theRB.DialogView
prototype for initialization,
rendering, and events with the necessary properties inRB.UploadAttachmentView
.
RB.UploadAttachmentView
also uses the button map provided byRB.DialogView
to
render its upload and cancel buttons, removing the need to create DOM nodes for
them directly in the class.The 'path' id is also removed and replaced with a 'js-path' class to reduce the
chance of conflicting elements.
- dialogView unit tests still pass
Manual testing:
- opening the dialog, uploading a file, and submitting it (without editing the caption)
- opening the dialog, uploading a file, editing the caption, and submitting it
- opening the dialog, editing the caption, uploading a file, and submitting it
- opening the dialog, uploading a file, then cancelling the dialog
- opening the dialog, editing the caption, then cancelling the dialog
- opening the dialog, then cancelling the dialog without uploading anything
- verified the 'Upload' button is disabled unless a file is actually uploaded
Description | From | Last Updated |
---|---|---|
This looks pretty solid, but there's one thing that's going to be important to address. The uploadAttachmentView.js file is a … |
chipx86 | |
Can you flesh out the summary, description, and testing a bit? What I'd like to see is a bit more … |
chipx86 | |
Looks good, but I realized the new filename isn't in staticbundles.py, which means the new version isn't being used. Can … |
chipx86 | |
We've found a handful of quirky issues with _super(), so we're trying to move away from it. It can get … |
chipx86 | |
Single quotes should be used where possible. (Old code may be using double quotes still, but any new/moved code should … |
chipx86 | |
These should also be using single quotes. |
chipx86 | |
This method needs to return this. It should also document that in the docstring. The docstring should also be using … |
chipx86 | |
This should have a trailing comma |
david | |
Since we've changed this to be es6 now, this should have a trailing comma. |
david | |
Trailing comma |
david | |
Trailing comma |
david | |
Since this is now a new-style doc comment, it should be written in the imperative mood ("Render the dialog" rather … |
david |
-
-
This looks pretty solid, but there's one thing that's going to be important to address.
The
uploadAttachmentView.js
file is a plain ES5 JavaScript file, but in it you're using some ES6 conventions (trailing commas on the last item in an array/dictionary), which isn't safe to include. So we either need to remove those or rename this touploadAttachmentView.es6.js
.I'd prefer the latter, so we can more easily maintain this going forward. Now this normally would also involve ES6ifying the file more, changing to newer-style function declarations (
render() { ... }
instead ofrender: function() { ... }
) and using newer-style dedented templates, but I think even without those it's worth doing the rename.(And those changes should all probably happen as another change, rather than cluttering up this change -- you don't have to do that work, just saying.)
-
We've found a handful of quirky issues with
_super()
, so we're trying to move away from it. It can get into infinite loops, depending on aspects of the parent classes. Can you update this to directly reference the parent prototype'srender
method?
- Commit:
-
5c3a86bd332d3e99a4fd390898bcab82a5b628c48e16f947d9b58d0324af784aeba465e8ee281df6
Checks run (2 succeeded)
-
-
Can you flesh out the summary, description, and testing a bit?
What I'd like to see is a bit more in the summary and in the description on what this change does.
Summary
"Refactoring" can mean so many things, and is kind of generic, but the first line of the description is a good initial summary. "Refactor RB.UploadAttachmentView to extend RB.DialogView."
Description
The description should then elaborate on that, explaining the why of this. What does this refactor get us.
The part about 'path' is a secondary detail, so it should be in its own paragraph. Use the first paragraph to tell the story of the reason for this change.
Testing
Testing should then provide enough information for the reviewer (and someone down the road potentially reproducing a bug) to know exactly what your testing process was. What were those manual tests? What did you do?
I like to list one thing per paragraph, saying what I tested and what the conditions were.
This is important, because it's easy to say something was tested but hard for a reviewer to know if that testing was sufficient, and they might have areas they're aware of to test that you may have missed.
-
Single quotes should be used where possible.
(Old code may be using double quotes still, but any new/moved code should use single quotes.)
-
-
This method needs to return
this
. It should also document that in the docstring.The docstring should also be using
/**
instead of/*
, which will tell doc generators about it.This is old code from before we adopted any modern doc conventions, which is why it wasn't doing this already, but since you're making changes to it, it's a good time to move that over.
- Change Summary:
-
Fix issues and add more info to description and testing.
- Summary:
-
Refactor RB.UploadAttachmentViewRefactor RB.UploadAttachmentView to extend RB.DialogView
- Description:
-
~ This review request refactors
RB.UploadAttachmentView
to extendRB.DialogView
as opposed~ to calling the RB.DialogView
constructor andmodalBox
directly. The 'path' id is also~ removed and replaced with a 'js-path' class to reduce the chance of conflicting elements. ~ This review request refactors
RB.UploadAttachmentView
to extendRB.DialogView
~ as opposed to calling the RB.DialogView
constructor andmodalBox
directly.~ The change involves extending the RB.DialogView
prototype for initialization,+ rendering, and events with the necessary properties in RB.UploadAttachmentView
.+ RB.UploadAttachmentView
also uses the button map provided byRB.DialogView
to+ render its upload and cancel buttons, removing the need to create DOM nodes for + them directly in the class. + + The 'path' id is also removed and replaced with a 'js-path' class to reduce the
+ chance of conflicting elements. - Testing Done:
-
~ Manual verification & dialogView unit tests
~ - dialogView unit tests still pass
+ + Manual testing:
+ - opening the dialog, uploading a file, and submitting it (without editing the caption) + - opening the dialog, uploading a file, editing the caption, and submitting it + - opening the dialog, editing the caption, uploading a file, and submitting it + - opening the dialog, uploading a file, then cancelling the dialog + - opening the dialog, editing the caption, then cancelling the dialog + - opening the dialog, then cancelling the dialog without uploading anything + - verified the 'Upload' button is disabled unless a file is actually uploaded - Commit:
-
8e16f947d9b58d0324af784aeba465e8ee281df628238a2866270fb8a6e07e4b07053eba52943024
Checks run (2 succeeded)
- Change Summary:
-
Fix issues from review
- Commit:
-
28238a2866270fb8a6e07e4b07053eba529430244a89476199fc98a90688a4638c8f0ab83fc777fc