Double-clicking to Add a Comment in the Diff View Discards Any Comments Made
Review Request #6340 — Created Sept. 19, 2014 and submitted — Latest diff uploaded
When double-clicking on a line number to add a comment in the diff view, this is registered as two seperate clicks. The comment dialog opens on the first click, and then on the second click the dialog is closed, the comment is deleted, and then the dialog is reopened (but no new comment is created). So, clicking save would not save the comment.
To solve this:
Before the comment dialog is shown, first check to see if there is already a comment dialog active. If there is, and it is a comment dialog for the same block as the one that is about to be shown, then don't show a new comment dialog (keep the old one as it displays the same comment). A double-click is registered as two clicks for the same comment block, and so the first click will show the dialog, and the second will do nothing.
Tried all of the following (in Firefox, Chrome):
- Adding comment by double-clicking on a line number and comment flag
- Adding comment by single-clicking on a line number and comment flag
- Adding comment by selecting a range of linesAll JavaScript unit tests passed.