Commit 81b4c3fb authored by Randall Leeds's avatar Randall Leeds

stop the thread.message.annotation insanity

The annotation is the message.
parent acbb7c50
......@@ -254,7 +254,7 @@ class Annotation
$scope.origText = $scope.model.$modelValue.text
$scope.delete = ->
annotation = $scope.thread.message.annotation
annotation = $scope.thread.message
replies = $scope.thread.children?.length or 0
# We can delete the annotation if it hasn't got any replies or it is
......
......@@ -24,14 +24,12 @@ class Annotator.Plugin.Threading extends Annotator.Plugin
# Get or create a thread to contain the annotation
thread = (@annotator.threading.getContainer annotation.id)
thread.message =
annotation: annotation
id: annotation.id
references: annotation.thread?.split('/')
thread.message = annotation
# Attach the thread to its parent, if any.
references = thread.message?.references
references = annotation.thread?.split('/')
if references?.length
annotation.references = references
prev = references[references.length-1]
@annotator.threading.getContainer(prev).addChild thread
......@@ -47,10 +45,7 @@ class Annotator.Plugin.Threading extends Annotator.Plugin
if thread.parent? then @annotator.threading.pruneEmpties thread.parent
annotationsLoaded: (annotations) =>
@annotator.threading.thread annotations.map (a) ->
annotation: a
id: a.id
references: a.thread?.split '/'
@annotator.threading.thread annotations
beforeAnnotationCreated: (annotation) =>
this.thread annotation
......@@ -297,7 +297,7 @@ class Hypothesis extends Annotator
if annotation.id? and annotation.id != data.id
# Update the id table for the threading
thread = @threading.getContainer annotation.id
thread.message.id = data.id
thread.id = data.id
@threading.idTable[data.id] = thread
delete @threading.idTable[annotation.id]
......
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