From 791da06e6e270b476323fa5213f46bcc2c4631b1 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Wed, 5 Jul 2017 15:41:04 +0100 Subject: [PATCH] Consolidate members list. --- .../app/views/project/editor/review-panel.pug | 36 +++++++++++-------- .../controllers/ReviewPanelController.coffee | 11 ++++++ 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/services/web/app/views/project/editor/review-panel.pug b/services/web/app/views/project/editor/review-panel.pug index f6b4066250..844e7946e4 100644 --- a/services/web/app/views/project/editor/review-panel.pug +++ b/services/web/app/views/project/editor/review-panel.pug @@ -67,24 +67,30 @@ on-toggle="toggleTrackChangesForEveryone(isOn);" disabled="!project.features.trackChanges || !permissions.write" ) - li.rp-tc-state-item - 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[project.owner._id].hue }}, 70%, 40%);" - ) {{ users[project.owner._id].name }} - review-panel-toggle( - ng-model="reviewPanel.trackChangesState[project.owner._id].value" - on-toggle="toggleTrackChangesForUser(isOn, project.owner._id);" - disabled="reviewPanel.trackChangesOnForEveryone || !project.features.trackChanges || !permissions.write" - ) - li.rp-tc-state-item(ng-repeat="member in project.members | filter:{ privileges: 'readAndWrite' }") + //- li.rp-tc-state-item( + //- ng-init="formattedOwner = formatUser(project.owner);" + //- ) + //- pre {{ project.owner | json }} + //- pre {{ formattedOwner | json }} + //- span.rp-tc-state-item-name.rp-tc-state-item-owner( + //- ng-class="{ 'rp-tc-state-item-name-disabled' : reviewPanel.trackChangesOnForEveryone}" + //- style="color: hsl({{ formattedOwner.hue }}, 70%, 40%);" + //- ) {{ formattedOwner.name }} + //- review-panel-toggle( + //- ng-model="reviewPanel.trackChangesState[formattedOwner.id].value" + //- on-toggle="toggleTrackChangesForUser(isOn, formattedOwner.id);" + //- disabled="reviewPanel.trackChangesOnForEveryone || !project.features.trackChanges || !permissions.write" + //- ) + li.rp-tc-state-item( + ng-repeat="member in reviewPanel.formattedProjectMembers" + ) span.rp-tc-state-item-name( ng-class="{ 'rp-tc-state-item-name-disabled' : reviewPanel.trackChangesOnForEveryone}" - style="color: hsl({{ users[member._id].hue }}, 70%, 40%);" - ) {{ users[member._id].name }} + style="color: hsl({{ member.hue }}, 70%, 40%);" + ) {{ member.name }} review-panel-toggle( - ng-model="reviewPanel.trackChangesState[member._id].value" - on-toggle="toggleTrackChangesForUser(isOn, member._id);" + ng-model="reviewPanel.trackChangesState[member.id].value" + on-toggle="toggleTrackChangesForUser(isOn, member.id);" disabled="reviewPanel.trackChangesOnForEveryone || !project.features.trackChanges || !permissions.write" ) 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 f697e5093c..800e5aace8 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -33,6 +33,7 @@ define [ commentThreads: {} resolvedThreadIds: {} rendererData: {} + formattedProjectMembers: {} fullTCStateCollapsed: true loadingThreads: false # All selected changes. If a aggregated change (insertion + deletion) is selection, the two ids @@ -68,6 +69,15 @@ define [ if !visible $scope.ui.reviewPanelOpen = false + $scope.$watch "project.members", (members) -> + $scope.reviewPanel.formattedProjectMembers = {} + if $scope.project?.owner? + $scope.reviewPanel.formattedProjectMembers[$scope.project.owner._id] = formatUser($scope.project.owner) + if $scope.project?.members? + for member in members + if member.privileges == "readAndWrite" + $scope.reviewPanel.formattedProjectMembers[member._id] = formatUser(member) + $scope.commentState = adding: false content: "" @@ -647,6 +657,7 @@ define [ return if _inited project = ide.$scope.project if project.features.trackChanges + window.trackChangesState ?= false applyTrackChangesStateToClient(window.trackChangesState) else applyTrackChangesStateToClient(false)