Fix annotating while signed out
If the user creates annotations while signed out and then signs in, we want those annotations to still be present in the sidebar after sign in, rather than being lost. Commit 7a1b5ca8d99252d3a086a8a8103fca4702521d06 had inadvertently broken this. The problem is that app.coffee destroys all AnnotationController instances on sign in, and only creates new instances for those annotations that have drafts. 7a1b5ca8d99252d3a086a8a8103fca4702521d06 removed a spurious call to saveToDrafts() in vm.edit() but it turns out that this call was (apparently inadvertently) the only thing that was causing drafts of annotations created while signed out to be saved, and hence the only thing causing these annotations to persist across sign ins. So add a listener for the USER_CHANGED event and save drafts of annotations on sign in, just before the AnnotationControllers get destroyed.
Showing
Please register or sign in to comment