3727: Are you sure popup if textbox is open.
- Fixed
- Review Board
theo.b******@gmai***** (Google Code) (Is this you? Claim this profile.) | |
|
What version are you running? 2.1 alpha 0 (dev) What's the URL of the page containing the problem? https://reviews.reviewboard.org/r/6797/ What steps will reproduce the problem? 1. Click on a textfield and edit some text 2. Click publish 3. There is a "Are you sure you want to leave this page popup" What is the expected output? What do you see instead? I expect it to not have a popup. What operating system are you using? What browser? OSX 10.10.1 Chrome Version 39.0.2171.95 (64-bit)
I will try this.
I solved another easyfix, and will stop working on it. It is intermittent bug, and it doesn't always happen.
I have new STR for this and can reproduce on master:
- Create and publish a review request
- View the review request page, ensuring that you have edit rights to it
- Click on the "Review" button to create a review for yourself
- Click on Publish
When the "Review" button is clicked and the dialog is brought up, we
initialize
theRB.ReviewDialogView
, which results in us incrementing theeditCount
on thereviewRequestEditor
for the page, right here. It's not clear why we bump the edito count for the review request editor, and not some edit count on a review editor, but that's besides the point.So at this stage, the
editCount
of thereviewRequestEditor
is now 1.It looks like if you have edit rights on a review request, when clicking "Publish" for the review, we enter this block.
There is an async function queue in there, and the one that sends the "publish"ing request to the API is this one. The
saveFunc
in the case of publishing the review is theRB.DraftReview
publish method.Note that there's a later function in the queue that is supposed to close the dialog.
That
saveFunc
method, on success, triggers the 'published' event, and here's where things go awry - theRB.ReviewablePageView
is listening for both the 'destroy' and the 'published' event, and when it sees them, it triggers the page reload. That means that the async function that closes the review dialog (and decrements theeditCount
) never runs, which means that theonbeforeunload
function defined in theRB.ReviewRequestEditorView
will execute and show the dialog.
-
- Fixed + New -
+ mconley
Christian has a fix! Deferring the page location switch lets the last async function run, which will close the dialog, which will decrement the editCount.
hideAndReload: function() { var url = this.model.get('parentObject').get('reviewURL'); this.hide(function() { _.defer(function() { window.location = url; }); }, this); },
-
- mconley + chipx86
I'm going to try to drive this through this weekend (I like Christian's solution in comment 11, so I'll probably just put that up for review and try to get it landed).
-
- chipx86 + mconley