Commit 9cfdb051 authored by gergely-ujvari's avatar gergely-ujvari

Fix: Stream showing reply annotations without their parents

If new annotation data arrives via websocket, the applyUpdates()
function processes it and injects the new annotation data into our
client-side annotation-db.

Some annotations (depending on the viewstate) are put immediately into the viewer
by adding them to the $rootScope.annotations

However, in the case of the stream page reply annotations can arrive without
their parent annotation, and because that they didn't get inserted into
the rootScope and thus never displayed

This commit fixes that, by letting these annotations inserted into
the rootScope.annotations for document viewstate (which the stream uses)
parent 72adb57e
......@@ -399,7 +399,9 @@ class App
if action == 'past'
action = 'create'
inRootScope = (annotation) ->
inRootScope = (annotation, recursive = false) ->
if recursive and annotation.references?
return inRootScope({id: annotation.references[0]})
for ann in $rootScope.annotations
return true if ann.id is annotation.id
false
......@@ -432,8 +434,8 @@ class App
for annotation in data
switch $rootScope.viewState.view
when 'Document'
unless annotator.isComment(annotation) or annotation.references?
$rootScope.annotations.push annotation if not inRootScope(annotation)
unless annotator.isComment(annotation)
$rootScope.annotations.push annotation if not inRootScope(annotation, true)
when 'Comments'
if annotator.isComment(annotation)
$rootScope.annotations.push annotation if not inRootScope(annotation)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment