Commit e3c473c1 authored by csillag's avatar csillag Committed by Randall Leeds

Hide orphan annotations in the sidebar

parent 5b861c1f
......@@ -16,6 +16,7 @@ Annotator.prototype.setupAnnotation = (annotation) ->
@selectedTargets = []
annotation.anchors = []
hasAnchor = false
for t in annotation.target ? []
try
......@@ -27,13 +28,16 @@ Annotator.prototype.setupAnnotation = (annotation) ->
if anchor?
t.diffHTML = anchor.diffHTML
t.diffCaseOnly = anchor.diffCaseOnly
hasAnchor = true
catch exception
console.log "Error in setupAnnotation for", annotation.id,
":", exception.stack ? exception
annotation
if annotation.target?.length and not hasAnchor
annotation.$orphan = true
annotation
# Override deleteAnnotation to deal with anchors, not highlights.
Annotator.prototype.deleteAnnotation = (annotation) ->
......
......@@ -20,7 +20,7 @@ module.exports = class CrossFrame
new Discovery($window, options)
createAnnotationSync = ->
whitelist = ['$highlight', 'target', 'document', 'uri']
whitelist = ['$highlight', '$orphan', 'target', 'document', 'uri']
options =
formatter: (annotation) ->
formatted = {}
......
......@@ -70,3 +70,5 @@ module.exports = class WidgetController
$scope.hasFocus = (annotation) ->
!!($scope.focusedAnnotations ? {})[annotation?.$$tag]
$scope.notOrphan = (container) -> !container?.message?.$orphan
......@@ -40,7 +40,7 @@
ng-mouseenter="focus(child.message)"
ng-click="scrollTo(child.message)"
ng-mouseleave="focus()"
ng-repeat="child in threadRoot.children | orderBy : sort.predicate"
ng-repeat="child in threadRoot.children | filter:notOrphan | orderBy : sort.predicate"
ng-show="shouldShowThread(child) && (count('edit') || count('match') || !threadFilter.active())">
</li>
</ul>
......
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