mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
track changes for anonymous users
This commit is contained in:
parent
0d02b860d9
commit
f9b8ada215
3 changed files with 9 additions and 6 deletions
|
@ -20,6 +20,8 @@ module.exports = TrackChangesController =
|
||||||
RangesManager.getAllChangesUsers project_id, (error, users) ->
|
RangesManager.getAllChangesUsers project_id, (error, users) ->
|
||||||
return next(error) if error?
|
return next(error) if error?
|
||||||
users = (UserInfoController.formatPersonalInfo(user) for user in users)
|
users = (UserInfoController.formatPersonalInfo(user) for user in users)
|
||||||
|
# Get rid of any anonymous/deleted user objects
|
||||||
|
users = users.filter (u) -> u?.id?
|
||||||
res.json users
|
res.json users
|
||||||
|
|
||||||
acceptChange: (req, res, next) ->
|
acceptChange: (req, res, next) ->
|
||||||
|
|
|
@ -93,7 +93,7 @@ define [
|
||||||
|
|
||||||
setTrackChanges: (value) ->
|
setTrackChanges: (value) ->
|
||||||
if value
|
if value
|
||||||
@$scope.sharejsDoc?.track_changes_as = window.user.id
|
@$scope.sharejsDoc?.track_changes_as = window.user.id or "anonymous"
|
||||||
else
|
else
|
||||||
@$scope.sharejsDoc?.track_changes_as = null
|
@$scope.sharejsDoc?.track_changes_as = null
|
||||||
|
|
||||||
|
@ -230,10 +230,6 @@ define [
|
||||||
if marker.clazz.match("track-changes")
|
if marker.clazz.match("track-changes")
|
||||||
console.error "Orphaned ace marker", marker
|
console.error "Orphaned ace marker", marker
|
||||||
|
|
||||||
applyChange: (delta, metadata) ->
|
|
||||||
op = @_aceChangeToShareJs(delta)
|
|
||||||
@rangesTracker.applyOp(op, metadata)
|
|
||||||
|
|
||||||
updateFocus: () ->
|
updateFocus: () ->
|
||||||
selection = @editor.getSelectionRange()
|
selection = @editor.getSelectionRange()
|
||||||
cursor_offset = @_aceRangeToShareJs(selection.start)
|
cursor_offset = @_aceRangeToShareJs(selection.start)
|
||||||
|
|
|
@ -346,7 +346,12 @@ define [
|
||||||
.success (users) ->
|
.success (users) ->
|
||||||
_refreshingRangeUsers = false
|
_refreshingRangeUsers = false
|
||||||
$scope.users = {}
|
$scope.users = {}
|
||||||
|
# Always include ourself, since if we submit an op, we might need to display info
|
||||||
|
# about it locally before it has been flushed through the server
|
||||||
|
if ide.$scope.user?.id?
|
||||||
|
$scope.users[ide.$scope.user.id] = formatUser(ide.$scope.user)
|
||||||
for user in users
|
for user in users
|
||||||
|
if user.id?
|
||||||
$scope.users[user.id] = formatUser(user)
|
$scope.users[user.id] = formatUser(user)
|
||||||
.error () ->
|
.error () ->
|
||||||
_refreshingRangeUsers = false
|
_refreshingRangeUsers = false
|
||||||
|
|
Loading…
Reference in a new issue