Properly sync resolved comments dropdown to entries

This commit is contained in:
James Allen 2017-01-11 14:13:49 +01:00
parent 4ee4aa9f0a
commit a081ae7307
2 changed files with 10 additions and 3 deletions

View file

@ -152,6 +152,8 @@ define [
rangesTracker = getChangeTracker(doc_id)
entries = getDocEntries(doc_id)
changed = false
# Assume we'll delete everything until we see it, then we'll remove it from this object
delete_changes = {}
for change_id, change of entries
@ -159,6 +161,7 @@ define [
delete_changes[change_id] = true
for change in rangesTracker.changes
changed = true
delete delete_changes[change.id]
entries[change.id] ?= {}
@ -178,6 +181,7 @@ define [
refreshChangeUsers(change.metadata.user_id)
for comment in rangesTracker.comments
changed = true
delete delete_changes[comment.id]
entries[comment.id] ?= {}
new_entry = {
@ -190,8 +194,12 @@ define [
entries[comment.id][key] = value
for change_id, _ of delete_changes
changed = true
delete entries[change_id]
if changed
$scope.$broadcast "entries:changed"
$scope.$on "editor:track-changes:changed", () ->
doc_id = $scope.editor.open_doc_id
updateEntries(doc_id)

View file

@ -21,7 +21,6 @@ define [
scope.toggleOpenState = () ->
scope.state.isOpen = !scope.state.isOpen
if (scope.state.isOpen)
filterResolvedComments()
scope.onOpen()
scope.resolvedComments = []
@ -55,4 +54,4 @@ define [
scope.resolvedComments.push(resolvedComment)
scope.$watchCollection "resolvedIds", filterResolvedComments
scope.$on "entries:changed", filterResolvedComments