From 1ae53a243a1728db28e2758c925b0ff62f1fa3fd Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 30 Jun 2017 15:25:37 +0100 Subject: [PATCH] Correctly fetch users from project info. --- services/web/app/views/project/editor/review-panel.pug | 10 +++++----- .../controllers/ReviewPanelController.coffee | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/services/web/app/views/project/editor/review-panel.pug b/services/web/app/views/project/editor/review-panel.pug index 3fe8c1a961..88c3785850 100644 --- a/services/web/app/views/project/editor/review-panel.pug +++ b/services/web/app/views/project/editor/review-panel.pug @@ -61,16 +61,16 @@ //- disabled="!project.features.trackChanges" //- on-disabled-click="openTrackChangesUpgradeModal" li.rp-tc-state-item - span.rp-tc-state-item-name.rp-tc-state-item-self( + span.rp-tc-state-item-name.rp-tc-state-item-owner( ng-class="{ 'rp-tc-state-item-name-disabled' : reviewPanel.trackChangesOnForEveryone}" - style="color: hsl({{ users[user.id].hue }}, 70%, 40%);" - ) {{ users[user.id].name }} + style="color: hsl({{ users[project.owner._id].hue }}, 70%, 40%);" + ) {{ users[project.owner._id].name }} //- {{user.id}} //- Missing on-toggle attribute because we also need to pass user_id to the toggleTrackChangesForUser //- method, and it's not clear how. review-panel-toggle( - ng-model="reviewPanel.trackChangesState[user.id].value" - on-toggle="toggleTrackChangesForUser(isOn, user.id);" + ng-model="reviewPanel.trackChangesState[project.owner._id].value" + on-toggle="toggleTrackChangesForUser(isOn, project.owner._id);" disabled="reviewPanel.trackChangesOnForEveryone" ) li.rp-tc-state-item(ng-repeat="member in project.members") 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 46ca00da65..4760211924 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -584,7 +584,7 @@ define [ $scope.reviewPanel.trackChangesOnForEveryone = false for member in $scope.project.members _setUserState(member._id, state[member._id] ? false) - _setUserState(ide.$scope.user.id, state[ide.$scope.user.id] ? false) + _setUserState($scope.project.owner._id, state[$scope.project.owner._id] ? false) for id, state of $scope.reviewPanel.trackChangesState console.log id, state.value, state.syncState @@ -609,7 +609,7 @@ define [ else data = {on_for: {}} for userId, userState of $scope.reviewPanel.trackChangesState - data.on_for[userId] = true if userState.value + data.on_for[userId] = userState.value data._csrf = window.csrfToken $http.post "/project/#{$scope.project_id}/track_changes", data