mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge branch 'ja-track-changes' of github.com:sharelatex/web-sharelatex into ja-track-changes
This commit is contained in:
commit
22db36d21b
3 changed files with 22 additions and 36 deletions
|
@ -35,11 +35,11 @@ define [
|
||||||
@$scope.$on "comment:remove", (e, comment_id) =>
|
@$scope.$on "comment:remove", (e, comment_id) =>
|
||||||
@removeCommentId(comment_id)
|
@removeCommentId(comment_id)
|
||||||
|
|
||||||
@$scope.$on "comment:resolve", (e, comment_id, user_id) =>
|
@$scope.$on "comment:resolve_thread", (e, thread_id) =>
|
||||||
@resolveCommentId(comment_id, user_id)
|
@resolveCommentByThreadId(thread_id)
|
||||||
|
|
||||||
@$scope.$on "comment:unresolve", (e, comment_id) =>
|
@$scope.$on "comment:unresolve_thread", (e, thread_id) =>
|
||||||
@unresolveCommentId(comment_id)
|
@unresolveCommentByThreadId(thread_id)
|
||||||
|
|
||||||
@$scope.$on "review-panel:recalculate-screen-positions", () =>
|
@$scope.$on "review-panel:recalculate-screen-positions", () =>
|
||||||
@recalculateReviewEntriesScreenPositions()
|
@recalculateReviewEntriesScreenPositions()
|
||||||
|
@ -90,9 +90,7 @@ define [
|
||||||
@rangesTracker.off "comment:added"
|
@rangesTracker.off "comment:added"
|
||||||
@rangesTracker.off "comment:moved"
|
@rangesTracker.off "comment:moved"
|
||||||
@rangesTracker.off "comment:removed"
|
@rangesTracker.off "comment:removed"
|
||||||
@rangesTracker.off "comment:resolved"
|
|
||||||
@rangesTracker.off "comment:unresolved"
|
|
||||||
|
|
||||||
setTrackChanges: (value) ->
|
setTrackChanges: (value) ->
|
||||||
if value
|
if value
|
||||||
@$scope.sharejsDoc?.track_changes_as = window.user.id
|
@$scope.sharejsDoc?.track_changes_as = window.user.id
|
||||||
|
@ -129,12 +127,6 @@ define [
|
||||||
@rangesTracker.on "comment:removed", (comment) =>
|
@rangesTracker.on "comment:removed", (comment) =>
|
||||||
sl_console.log "[comment:removed]", comment
|
sl_console.log "[comment:removed]", comment
|
||||||
setTimeout () => @_onCommentRemoved(comment)
|
setTimeout () => @_onCommentRemoved(comment)
|
||||||
@rangesTracker.on "comment:resolved", (comment) =>
|
|
||||||
sl_console.log "[comment:resolved]", comment
|
|
||||||
setTimeout () => @_onCommentRemoved(comment)
|
|
||||||
@rangesTracker.on "comment:unresolved", (comment) =>
|
|
||||||
sl_console.log "[comment:unresolved]", comment
|
|
||||||
setTimeout () => @_onCommentAdded(comment)
|
|
||||||
|
|
||||||
redrawAnnotations: () ->
|
redrawAnnotations: () ->
|
||||||
for change in @rangesTracker.changes
|
for change in @rangesTracker.changes
|
||||||
|
@ -187,13 +179,18 @@ define [
|
||||||
removeCommentId: (comment_id) ->
|
removeCommentId: (comment_id) ->
|
||||||
@rangesTracker.removeCommentId(comment_id)
|
@rangesTracker.removeCommentId(comment_id)
|
||||||
|
|
||||||
resolveCommentId: (comment_id, user_id) ->
|
RESOLVED_THREADS: {}
|
||||||
@rangesTracker.resolveCommentId(comment_id, {
|
resolveCommentByThreadId: (thread_id) ->
|
||||||
user_id, ts: new Date()
|
@RESOLVED_THREADS[thread_id] = true
|
||||||
})
|
for comment in @rangesTracker?.comments or []
|
||||||
|
if comment.op.t == thread_id
|
||||||
|
@_onCommentRemoved(comment)
|
||||||
|
|
||||||
unresolveCommentId: (comment_id) ->
|
unresolveCommentByThreadId: (thread_id) ->
|
||||||
@rangesTracker.unresolveCommentId(comment_id)
|
@RESOLVED_THREADS[thread_id] = false
|
||||||
|
for comment in @rangesTracker?.comments or []
|
||||||
|
if comment.op.t == thread_id
|
||||||
|
@_onCommentAdded(comment)
|
||||||
|
|
||||||
checkMapping: () ->
|
checkMapping: () ->
|
||||||
# TODO: reintroduce this check
|
# TODO: reintroduce this check
|
||||||
|
@ -335,6 +332,9 @@ define [
|
||||||
@broadcastChange()
|
@broadcastChange()
|
||||||
|
|
||||||
_onCommentAdded: (comment) ->
|
_onCommentAdded: (comment) ->
|
||||||
|
if @RESOLVED_THREADS[comment.op.t]
|
||||||
|
# Comment is resolved so shouldn't be displayed.
|
||||||
|
return
|
||||||
if !@changeIdToMarkerIdMap[comment.id]?
|
if !@changeIdToMarkerIdMap[comment.id]?
|
||||||
# Only create new markers if they don't already exist
|
# Only create new markers if they don't already exist
|
||||||
start = @_shareJsOffsetToAcePosition(comment.op.p)
|
start = @_shareJsOffsetToAcePosition(comment.op.p)
|
||||||
|
|
|
@ -63,19 +63,6 @@ load = (EventEmitter) ->
|
||||||
break
|
break
|
||||||
return comment
|
return comment
|
||||||
|
|
||||||
resolveCommentId: (comment_id, resolved_data) ->
|
|
||||||
comment = @getComment(comment_id)
|
|
||||||
return if !comment?
|
|
||||||
comment.metadata.resolved = true
|
|
||||||
comment.metadata.resolved_data = resolved_data
|
|
||||||
@emit "comment:resolved", comment
|
|
||||||
|
|
||||||
unresolveCommentId: (comment_id) ->
|
|
||||||
comment = @getComment(comment_id)
|
|
||||||
return if !comment?
|
|
||||||
comment.metadata.resolved = false
|
|
||||||
@emit "comment:unresolved", comment
|
|
||||||
|
|
||||||
removeCommentId: (comment_id) ->
|
removeCommentId: (comment_id) ->
|
||||||
comment = @getComment(comment_id)
|
comment = @getComment(comment_id)
|
||||||
return if !comment?
|
return if !comment?
|
||||||
|
|
|
@ -32,6 +32,7 @@ define [
|
||||||
for comment in thread.messages
|
for comment in thread.messages
|
||||||
formatComment(comment)
|
formatComment(comment)
|
||||||
if thread.resolved_by_user?
|
if thread.resolved_by_user?
|
||||||
|
$scope.$broadcast "comment:resolve_thread", thread_id
|
||||||
formatUser(thread.resolved_by_user)
|
formatUser(thread.resolved_by_user)
|
||||||
$scope.reviewPanel.commentThreads = threads
|
$scope.reviewPanel.commentThreads = threads
|
||||||
|
|
||||||
|
@ -146,8 +147,6 @@ define [
|
||||||
new_entry = {
|
new_entry = {
|
||||||
type: "comment"
|
type: "comment"
|
||||||
thread_id: comment.op.t
|
thread_id: comment.op.t
|
||||||
resolved: comment.metadata?.resolved
|
|
||||||
resolved_data: comment.metadata?.resolved_data
|
|
||||||
content: comment.op.c
|
content: comment.op.c
|
||||||
offset: comment.op.p
|
offset: comment.op.p
|
||||||
}
|
}
|
||||||
|
@ -243,7 +242,7 @@ define [
|
||||||
thread.resolved_by_user = $scope.users[window.user_id]
|
thread.resolved_by_user = $scope.users[window.user_id]
|
||||||
thread.resolved_at = new Date()
|
thread.resolved_at = new Date()
|
||||||
$http.post "/project/#{$scope.project_id}/thread/#{entry.thread_id}/resolve", {_csrf: window.csrfToken}
|
$http.post "/project/#{$scope.project_id}/thread/#{entry.thread_id}/resolve", {_csrf: window.csrfToken}
|
||||||
$scope.$broadcast "comment:resolve", entry_id, window.user_id
|
$scope.$broadcast "comment:resolve_thread", entry.thread_id
|
||||||
|
|
||||||
$scope.unresolveComment = (entry, entry_id) ->
|
$scope.unresolveComment = (entry, entry_id) ->
|
||||||
thread = $scope.reviewPanel.commentThreads[entry.thread_id]
|
thread = $scope.reviewPanel.commentThreads[entry.thread_id]
|
||||||
|
@ -251,7 +250,7 @@ define [
|
||||||
delete thread.resolved_by_user
|
delete thread.resolved_by_user
|
||||||
delete thread.resolved_at
|
delete thread.resolved_at
|
||||||
$http.post "/project/#{$scope.project_id}/thread/#{entry.thread_id}/reopen", {_csrf: window.csrfToken}
|
$http.post "/project/#{$scope.project_id}/thread/#{entry.thread_id}/reopen", {_csrf: window.csrfToken}
|
||||||
$scope.$broadcast "comment:unresolve", entry_id
|
$scope.$broadcast "comment:unresolve_thread", entry.thread_id
|
||||||
|
|
||||||
$scope.deleteComment = (entry_id) ->
|
$scope.deleteComment = (entry_id) ->
|
||||||
$scope.$broadcast "comment:remove", entry_id
|
$scope.$broadcast "comment:remove", entry_id
|
||||||
|
|
Loading…
Reference in a new issue