mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-03 14:24:06 -05:00
Refactor accept and reject methods to support multiple changes; support bulk actions events.
This commit is contained in:
parent
36b4a8e6c2
commit
7f3c0ed5ac
2 changed files with 40 additions and 25 deletions
|
@ -27,10 +27,16 @@ define [
|
||||||
@selectLineIfNoSelection()
|
@selectLineIfNoSelection()
|
||||||
|
|
||||||
@$scope.$on "change:accept", (e, change_id) =>
|
@$scope.$on "change:accept", (e, change_id) =>
|
||||||
@acceptChangeId(change_id)
|
@acceptChangeIds([ change_id ])
|
||||||
|
|
||||||
@$scope.$on "change:reject", (e, change_id) =>
|
@$scope.$on "change:reject", (e, change_id) =>
|
||||||
@rejectChangeId(change_id)
|
@rejectChangeIds([ change_id ])
|
||||||
|
|
||||||
|
@$scope.$on "change:bulk-accept", (e, change_ids) =>
|
||||||
|
@acceptChangeIds(change_ids)
|
||||||
|
|
||||||
|
@$scope.$on "change:bulk-reject", (e, change_ids) =>
|
||||||
|
@rejectChangeIds(change_ids)
|
||||||
|
|
||||||
@$scope.$on "comment:remove", (e, comment_id) =>
|
@$scope.$on "comment:remove", (e, comment_id) =>
|
||||||
@removeCommentId(comment_id)
|
@removeCommentId(comment_id)
|
||||||
|
@ -207,14 +213,15 @@ define [
|
||||||
if @editor.selection.isEmpty()
|
if @editor.selection.isEmpty()
|
||||||
@editor.selection.selectLine()
|
@editor.selection.selectLine()
|
||||||
|
|
||||||
acceptChangeId: (change_id) ->
|
acceptChangeIds: (change_ids) ->
|
||||||
@rangesTracker.removeChangeId(change_id)
|
@rangesTracker.removeChangeIds(change_ids)
|
||||||
@updateAnnotations()
|
@updateAnnotations()
|
||||||
|
|
||||||
rejectChangeId: (change_id) ->
|
rejectChangeIds: (change_ids) ->
|
||||||
change = @rangesTracker.getChange(change_id)
|
changes = @rangesTracker.getChanges(change_ids)
|
||||||
return if !change?
|
return if changes.length == 0
|
||||||
session = @editor.getSession()
|
session = @editor.getSession()
|
||||||
|
for change in changes
|
||||||
if change.op.d?
|
if change.op.d?
|
||||||
content = change.op.d
|
content = change.op.d
|
||||||
position = @_shareJsOffsetToAcePosition(change.op.p)
|
position = @_shareJsOffsetToAcePosition(change.op.p)
|
||||||
|
|
|
@ -77,6 +77,14 @@ define [
|
||||||
updateEntries(doc_id)
|
updateEntries(doc_id)
|
||||||
$scope.$apply () ->
|
$scope.$apply () ->
|
||||||
|
|
||||||
|
ide.socket.on "accept-changes", (doc_id, change_ids) ->
|
||||||
|
if doc_id != $scope.editor.open_doc_id
|
||||||
|
getChangeTracker(doc_id).removeChangeIds(change_ids)
|
||||||
|
else
|
||||||
|
$scope.$broadcast "change:bulk-accept", change_ids
|
||||||
|
updateEntries(doc_id)
|
||||||
|
$scope.$apply () ->
|
||||||
|
|
||||||
ide.socket.on "resolve-thread", (thread_id, user) ->
|
ide.socket.on "resolve-thread", (thread_id, user) ->
|
||||||
_onCommentResolved(thread_id, user)
|
_onCommentResolved(thread_id, user)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue