Track timestamps of changes

This commit is contained in:
James Allen 2016-11-09 12:19:48 +00:00
parent cd494f7866
commit 446ca7212a
3 changed files with 6 additions and 0 deletions

View file

@ -51,6 +51,7 @@ div.full-size(
.review-panel-scroller
.review-entry-list(review-panel-sorted)
.review-entry(ng-repeat="(entry_id, entry) in reviewPanel.entries", ng-style="{'top': top}")
div.small {{ entry.metadata.ts }}
{{ entry.content }}
.ui-layout-east

View file

@ -59,8 +59,10 @@ define [
offset, length, metadata
}
@emit "comment:added", comment
return comment
applyOp: (op, metadata) ->
metadata.ts ?= new Date()
# Apply an op that has been applied to the document to our changes to keep them up to date
if op.i?
@applyInsertToChanges(op, metadata)
@ -149,6 +151,7 @@ define [
is_same_user
offset = op_start - change_start
change.op.i = change.op.i.slice(0, offset) + op.i + change.op.i.slice(offset)
change.metadata.ts = metadata.ts
already_merged = true
moved_changes.push change
else if op_start <= change_start
@ -241,6 +244,7 @@ define [
if insert_remaining.length > 0
change.op.i = insert_remaining
change.op.p = Math.min(change_start, op_start)
change.metadata.ts = metadata.ts
moved_changes.push change
else
remove_changes.push change

View file

@ -143,6 +143,7 @@ define [
@$scope.reviewPanel.entries[change.id] = {
content: change.op.i or change.op.d
offset: change.op.p
metadata: change.metadata
}
for comment in @changesTracker.comments
@$scope.reviewPanel.entries[comment.id] = {