Unsaved diff drafts are kept in localstorage so they are not lost if they do not get saved (for example, if the browser crashes). However, this stored copy of the comment is cleared when the save request is started, not after it succeeds. As such, if the save request fails (for example, if the user credentials are invalid), the comment can be truly lost. With this change, the localstorage copy is only cleared after save success. If the request fails, it allows the error message to appear rather than showing a misleading "All comments saved" toast. Bug: issue 7289 Change-Id: Id5c8144ecccec50de35f83af616b4e4915b62b5c
15 KiB
15 KiB