From 20356a3d51292cb0d316711e2c4001660dae0308 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 4 Jul 2017 11:26:42 +0100 Subject: [PATCH] Keep user state persistent on the client. --- .../controllers/ReviewPanelController.coffee | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee index bbc27b7e77..7aa27b6c04 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -593,9 +593,11 @@ define [ if userId == ide.$scope.user.id $scope.editor.wantTrackChanges = newValue - _setEveryoneTCState = (newValue) -> + _setEveryoneTCState = (newValue, isLocal = false) -> $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 applyClientTrackChangesStateToServer = () -> @@ -625,8 +627,7 @@ define [ _setUserTCState($scope.project.owner._id, state[$scope.project.owner._id] ? false) $scope.toggleTrackChangesForEveryone = (onForEveryone) -> - console.log onForEveryone - _setEveryoneTCState onForEveryone + _setEveryoneTCState onForEveryone, true applyClientTrackChangesStateToServer() window.toggleTrackChangesForUser = # DEBUG LINE