Correctly fetch users from project info.

This commit is contained in:
Paulo Reis 2017-06-30 15:25:37 +01:00
parent 1cffb972d2
commit 8b7b3c539b
2 changed files with 7 additions and 7 deletions

View file

@ -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")

View file

@ -583,7 +583,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
@ -608,7 +608,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