Fix new comment discarding existing unsaved draft comments.
Review Request #9201 — Created Sept. 22, 2017 and submitted
When a comment box was open, clicking a new line to add another comment would
discard the current comment without warning or prompting the user to save
changes. The old comment box was silently closed, and a new one was opened.This change warns the user before the old comment box is closed. Pressing
cancel keeps the old comment box open. Pressing OK closes the old comment
box without saving it, and creates a new one.
Unit tests pass.
Manually tested clicking a new line to add a comment, when a current comment
box was open. Manually tested clicking a new line to add a comment, when a
previously saved comment box was open. Pressing OK continues to create a
new comment, discarding the unsaved comment. Pressing cancel returns to
the current open comment box.
Description | From | Last Updated |
---|---|---|
Can you add a unit test for this change? Mentors can help with what's required here. |
chipx86 | |
Col: 40 Expected '!==' and instead saw '!='. |
reviewbot | |
A few easy comments on this line: There should be no space between the ! and the confirm Can you … |
david | |
Please remove this newly-added line (we only want one blank line between class members) |
david | |
There's now an extra blank line here. |
david | |
This could be a little more compact by combining these into one conditional: if (this._activeCommentBlock !== null && !confirm(gettext('...'))) { |
david | |
One last thing: can we wrap this onto two lines to keep it less wide? Split it after the && … |
david | |
Can I suggest a wording change? How about: "You are currently editing another comment. Would you like to discard it … |
chipx86 |
- Commit:
-
beecc1182f93950607fa75b0595837c3383fcdd5532742f8bf9f94e5c96e70af2743119fbc7718b0
Checks run (2 succeeded)
- Commit:
-
532742f8bf9f94e5c96e70af2743119fbc7718b0f34e9329bc3c5cbe08234a6d1751c93d6cc31c8d
Checks run (2 succeeded)
- Commit:
-
f34e9329bc3c5cbe08234a6d1751c93d6cc31c8dafec64b40193d0cbd6c8c22e8ee21881ce4085ad
Checks run (2 succeeded)
- Commit:
-
afec64b40193d0cbd6c8c22e8ee21881ce4085ad169d09698f3e7ef8cc6a5f630d9e88aa7c4b664e
Checks run (2 succeeded)
- Commit:
-
169d09698f3e7ef8cc6a5f630d9e88aa7c4b664edb5b8165b5b7cbe1decfca20cb40c6d2b50e04ff
Checks run (2 succeeded)
- Commit:
-
db5b8165b5b7cbe1decfca20cb40c6d2b50e04ff9d1163ed1c77454c2f8b2f352b7e40e002f244b0
Checks run (2 succeeded)
- Testing Done:
-
Unit tests pass.
Manually tested clicking a new line to add a comment, when a current comment
~ box was open. Pressing OK continues to create a new comment, discarding the ~ unsaved comment. Pressing cancel returns to the current open comment box. ~ box was open. Manually tested clicking a new line to add a comment, when a ~ previously saved comment box was open. Pressing OK continues to create a + new comment, discarding the unsaved comment. Pressing cancel returns to + the current open comment box.