Wyatt Allen d563a713d6 Only erase unsaved drafts after save request succeeds
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
2017-10-27 12:56:04 -07:00
..