Fixed the Update -> Add File review request action not responding to clicks.
Review Request #9207 — Created Sept. 22, 2017 and submitted
Information | |
---|---|
nicho | |
Review Board | |
master | |
4592 | |
d2db62d... | |
Reviewers | |
reviewboard, students | |
In the Review Request screen, clicking Update -> Add File would not do
anything.The Update element's click event is registered before the Add File
element's click event. As a result, the Update element's click event is
firing before, eating up the Add File's click event and thus causing the
upload file dialog to never appear.The
onUploadFileClicked()
function was moved fromReviewablePageView
to
ReviewRequestEditorView
, and the element's handler registered in the
setupActions()
function. The.has-menu
handler was moved to
ReviewablePageView
, better respecting the ownership structure of the
page. This changes the order in which the click events are fired, allowing
theonUploadFileClicked()
function to actually fire in response to the
Add File element being clicked.Furthermore, the
has-menu
handler was moved from
ReviewRequestEditorView
toReviewablePageView
After the fix, the upload file dialog appears as intended.
Ran JSTests.
Tested manually by clicking Update -> Add File, where the upload file
dialog appears. This was done on both computer and mobile browsers.
Description | From | Last Updated |
---|---|---|
Also the description should always wrap at 70-75 characters. I recommend writing the description in your commit message. Many editors … |
|
|
The description doesn't make it clear what the source of the problem was or how this fixes it. Descriptions should … |
|
|
Missing period in the second-to-last paragraph of the description. |
|
|
For the summary, "in Review Request" is kind of akwardly-worded and not quite correct. I'd suggest the summary be: Fixed … |
|
|
"This method displays a popup..." |
|
|
Only one space between sentences. We're not using typewriters here! |
|
|
The reviewRequest variable is only used once, so we could remove the variable definition and juts move the model.get call … |
|
|
Undo this. |
|
|
Lets accept e (type Event) as an argument and call e.stopPropagation() and e.preventDefault() instead. |
|
|
Trailing whitespace |
|
|
Care to update this to use e.preventDefault() and e.stopPropagation() ? It too can be done at the top of the … |
|
|
No longer true. This function doesn't return anything. |
|
|
Mind updating this function to use preventDefault and stopPropagation too? |
|
|
No longer true. This function doesn't return anything. |
|
|
Mind adding Args to all these functions? |
|
|
Undo this. |
|
|
This is on the wrong class. It needs to be on RB.ReviewablePageView. Can you move it, and then we'll need … |
|
|
This one can do a return false and get rid of e. It's equivalent of these commands. The reason we'd … |
|
-
-
The description doesn't make it clear what the source of the problem was or how this fixes it. Descriptions should always tell a story of what the reported problem was, why it happened, and how it was fixed. Write it like you're telling someone what you did so they can write a report on it.
As far as I can tell, the event handler really should live on the page's view, not the
ReviewRequestEditorView
, so I'm not sure why it was moved. What was the source of the problem?
-
-
reviewboard/static/rb/js/views/reviewRequestEditorView.es6.js (Diff revision 1) "This method displays a popup..."
Change Summary:
Updated description to be more specific.
Summary: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
Testing Done: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
Commit: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 2 (+22 -20) |
Checks run (2 succeeded)
Change Summary:
Moved the Upload File handler to
ReviewRequestEditorView
, and the.has-menu
handler toReviewablePageView
.
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commit: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 3 (+38 -36) |
Checks run (2 succeeded)
-
-
reviewboard/static/rb/js/pages/views/reviewablePageView.es6.js (Diff revision 3) Only one space between sentences. We're not using typewriters here!
-
reviewboard/static/rb/js/views/reviewRequestEditorView.es6.js (Diff revision 3) The
reviewRequest
variable is only used once, so we could remove the variable definition and juts move themodel.get
call where it's used.
Change Summary:
Removed extra space in documentation.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+38 -38) |
Checks run (2 succeeded)
-
-
-
reviewboard/static/rb/js/views/reviewRequestEditorView.es6.js (Diff revision 4) Lets accept
e
(typeEvent
) as an argument and calle.stopPropagation()
ande.preventDefault()
instead.
Change Summary:
Removed redundant variable, readded line break that was accidentally removed and changed how the event propagation was being stopped in
onUploadFileClicked
.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 5 (+39 -38) |
Checks run (2 succeeded)
-
-
reviewboard/static/rb/js/pages/views/reviewablePageView.es6.js (Diff revision 5) Trailing whitespace
-
reviewboard/static/rb/js/pages/views/reviewablePageView.es6.js (Diff revision 5) Care to update this to use
e.preventDefault()
ande.stopPropagation()
? It too can be done at the top of the fn.
Change Summary:
Removed trailing whitespace, and changed how event propagation is consumed in
onShipItClicked
.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 6 (+40 -37) |
Checks run (2 succeeded)
-
-
reviewboard/static/rb/js/pages/views/reviewablePageView.es6.js (Diff revision 6) No longer true. This function doesn't return anything.
-
reviewboard/static/rb/js/pages/views/reviewablePageView.es6.js (Diff revision 6) Mind updating this function to use
preventDefault
andstopPropagation
too? -
reviewboard/static/rb/js/views/reviewRequestEditorView.es6.js (Diff revision 6) No longer true. This function doesn't return anything.
Change Summary:
Changed how
onMenuClicked
stops event propagation, removed documentation on return values for all functions that no longer return false to consume events.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 7 (+36 -43) |
Checks run (2 succeeded)
-
-
reviewboard/static/rb/js/pages/views/reviewablePageView.es6.js (Diff revision 7) Mind adding
Args
to all these functions? -
Change Summary:
Added args to all functions which were changed to take an Event as a parameter.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 8 (+46 -42) |
Checks run (2 succeeded)
-
-
reviewboard/static/rb/js/pages/views/reviewablePageView.es6.js (Diff revision 8) This is on the wrong class. It needs to be on
RB.ReviewablePageView
. Can you move it, and then we'll need to perform more strict testing.This particular event handler is from commit 7bfd3ae3, which says:
Fix clicking on actions for review requests.
For mobile usage, the actions now live in a top-level
<li>
with a
"has-menu" class. This was getting intercepted by an event handler that
was blocking clicks from triggering links. The event selector now points
to menus within that class.So what you need to do is active the browser's mobile mode. Set it for something like an iPhone 6S size. Reload the page. Then try clicking on actions within the menu. You'll definitely want to try actions a couple levels down, like the Close -> Submitted. Test this both before and after the proper fix.
You should also try using your phone, along with the above test, to make sure it works on mobile devices. You can get the IP of your laptop and try using it instead of
localhost
in the browser. You might need to configure your firewall appropriately, if it's interfering.
Change Summary:
Moved .has-menu click event registration to
RB.ReviewablePageView
.
Summary: |
|
|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
|||||||||||||||
Commit: |
|
|||||||||||||||
Diff: |
Revision 9 (+46 -42) |
Checks run (2 succeeded)
-
-
reviewboard/static/rb/js/pages/views/reviewablePageView.es6.js (Diff revision 9) This one can do a
return false
and get rid ofe
. It's equivalent of these commands. The reason we'd specifically call them is to ensure that they're called before any operations we care about occur, in case ours crash. In this particular case, we don't run any special code, so we can justreturn false
and let jQuery do its thing.
Change Summary:
Changed onShipItClicked to return false rather than calling methods to stop the event propogation.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 10 (+40 -37) |