Keep user state persistent on the client.

This commit is contained in:
Paulo Reis 2017-07-04 11:26:42 +01:00
parent 310a1341a1
commit 20356a3d51

View file

@ -593,9 +593,11 @@ define [
if userId == ide.$scope.user.id if userId == ide.$scope.user.id
$scope.editor.wantTrackChanges = newValue $scope.editor.wantTrackChanges = newValue
_setEveryoneTCState = (newValue) -> _setEveryoneTCState = (newValue, isLocal = false) ->
$scope.reviewPanel.trackChangesOnForEveryone = newValue $scope.reviewPanel.trackChangesOnForEveryone = newValue
$scope.reviewPanel.trackChangesState = {} for userId, userState of $scope.reviewPanel.trackChangesState
userState.value = newValue
userState.syncState = if isLocal then UserTCSyncState.PENDING else UserTCSyncState.SYNCED
$scope.editor.wantTrackChanges = newValue $scope.editor.wantTrackChanges = newValue
applyClientTrackChangesStateToServer = () -> applyClientTrackChangesStateToServer = () ->
@ -625,8 +627,7 @@ define [
_setUserTCState($scope.project.owner._id, state[$scope.project.owner._id] ? false) _setUserTCState($scope.project.owner._id, state[$scope.project.owner._id] ? false)
$scope.toggleTrackChangesForEveryone = (onForEveryone) -> $scope.toggleTrackChangesForEveryone = (onForEveryone) ->
console.log onForEveryone _setEveryoneTCState onForEveryone, true
_setEveryoneTCState onForEveryone
applyClientTrackChangesStateToServer() applyClientTrackChangesStateToServer()
window.toggleTrackChangesForUser = # DEBUG LINE window.toggleTrackChangesForUser = # DEBUG LINE