Commit b77a7bfe authored by Ujvari Gergely's avatar Ujvari Gergely

Standalone page fix when the annotation itself is deleted

- Separate delete handling for the root annotation
- After delete if shows a "This annotation has been deleted!" sign for this annotation.
- Redaction flow is unaffected
parent 64cd94c7
......@@ -866,9 +866,10 @@ blockquote {
margin:0;
}
.center_button {
text-align: center;
.knockout {
.center {
text-align: center;
}
}
.button_controls {
......
......@@ -22,6 +22,7 @@ class Displayer
$scope.annotation.reply_count = 0
$scope.annotation.ref_length =
if $scope.annotation.references? then $scope.annotation.references.length else 0
$scope.full_deleted = false
@idTable[$scope.annotation.id] = $scope.annotation
$scope.filter =
streamfilter
......@@ -104,17 +105,21 @@ class Displayer
unless @idTable[annotation.id]?
break
#Update the reply counter for all referenced annotation
for i in [$scope.annotation.ref_length..annotation.references.length-1]
reference = annotation.references[i]
@idTable[reference].reply_count -= 1
replies = @idTable[annotation.references[annotation.references.length-1]].replies
#Find the place to insert annotation
pos = replies.indexOf @idTable[annotation.id]
replies.splice pos, 1
delete @idTable[annotation.id]
if $scope.annotation.id = annotation.id
$scope.full_deleted = true
else
#Reply delete
#Update the reply counter for all referenced annotation
for i in [$scope.annotation.ref_length..annotation.references.length-1]
reference = annotation.references[i]
@idTable[reference].reply_count -= 1
replies = @idTable[annotation.references[annotation.references.length-1]].replies
#Find the place to insert annotation
pos = replies.indexOf @idTable[annotation.id]
replies.splice pos, 1
delete @idTable[annotation.id]
if $scope.annotation.referrers?
$scope.manage_new_data $scope.annotation.referrers, 'past'
......
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