mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -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) ->
|
||||
return next(error) if error?
|
||||
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
|
||||
|
||||
acceptChange: (req, res, next) ->
|
||||
|
|
|
@ -93,7 +93,7 @@ define [
|
|||
|
||||
setTrackChanges: (value) ->
|
||||
if value
|
||||
@$scope.sharejsDoc?.track_changes_as = window.user.id
|
||||
@$scope.sharejsDoc?.track_changes_as = window.user.id or "anonymous"
|
||||
else
|
||||
@$scope.sharejsDoc?.track_changes_as = null
|
||||
|
||||
|
@ -230,10 +230,6 @@ define [
|
|||
if marker.clazz.match("track-changes")
|
||||
console.error "Orphaned ace marker", marker
|
||||
|
||||
applyChange: (delta, metadata) ->
|
||||
op = @_aceChangeToShareJs(delta)
|
||||
@rangesTracker.applyOp(op, metadata)
|
||||
|
||||
updateFocus: () ->
|
||||
selection = @editor.getSelectionRange()
|
||||
cursor_offset = @_aceRangeToShareJs(selection.start)
|
||||
|
|
|
@ -346,7 +346,12 @@ define [
|
|||
.success (users) ->
|
||||
_refreshingRangeUsers = false
|
||||
$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
|
||||
if user.id?
|
||||
$scope.users[user.id] = formatUser(user)
|
||||
.error () ->
|
||||
_refreshingRangeUsers = false
|
||||
|
|
Loading…
Reference in a new issue