Permalink
Please sign in to comment.
Browse files
Refactor saving highlights in AnnotationController
* Rename local variable `highlight` to `newlyCreatedByHighlightButton` and add
a docstring - clarify what this piece of state actually means.
* Fix `vm.isHighlight()`: It now returns `false` for new annotations that the
user hasn't entered any text or tags for yet (instead of `true`).
* Move the code for saving new highlights to the server into a
`saveNewHighlight()` function that's called on AnnotationController
instantiation instead of having it in a `$watch()` function that's called
every time the local variable `model` changes.
Also use the presence of `model.id` to avoid re-saving highlights that have
already been saved - instead of abusing the `highlight`
(now `newlyCreatedByHighlightButton`) variable and confusing what it
represents.
* Don't automatically open the annotation editor on Annotationcontroller
instantiation if the annotation is a highlight. This fixes this bug:
1. Create a new highlight while logged out
2. Log in
3. Your highlight is saved to the server, but also the annotation editor is
open on your highlight.
The intention is that highlights are simply saved to the server, not opened
for editing.
_Annotations_ created while logged out, on the other hand, are _not_ saved
to the server on login but _are_ opened for editing on login.- Loading branch information...
Showing
with
83 additions
and 31 deletions.
0 comments on commit
fb2a1e0