From 184b421b1f6c5f1ddb17ce31fb9da68e85e4816b Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 9 Nov 2016 16:34:23 +0000 Subject: [PATCH] Show user name in comments --- services/web/app/views/project/editor/editor.jade | 2 +- .../controllers/ReviewPanelController.coffee | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/services/web/app/views/project/editor/editor.jade b/services/web/app/views/project/editor/editor.jade index 7feae8d0fe..13597f769a 100644 --- a/services/web/app/views/project/editor/editor.jade +++ b/services/web/app/views/project/editor/editor.jade @@ -62,8 +62,8 @@ div.full-size( | {{ entry.content }} div(ng-if="entry.type == 'comment'") div(ng-repeat="comment in entry.thread", class="comment-thread__comment") + div.small(style="color: hsl({{ users[comment.user_id].hue }}, 70%, 50%)") {{ users[comment.user_id].name }} div.small {{ comment.ts }} - div.small {{ comment.user_id }} | {{ comment.content }} div(ng-if="entry.replying") textarea(ng-model="entry.replyContent") 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 344d34f370..d94fe057cd 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -95,16 +95,21 @@ define [ entry.replyContent = "" $scope.$broadcast "review-panel:layout" + # TODO: Eventually we need to get this from the server, and update it + # when we get an id we don't know. This'll do for client side testing refreshUsers = () -> $scope.users = {} for member in $scope.project.members.concat($scope.project.owner) + if member._id == window.user_id + name = "You" + else + name = "#{member.first_name} #{member.last_name}" $scope.users[member._id] = { email: member.email - name: "#{member.first_name} #{member.last_name}" + name: name hue: ColorManager.getHueForUserId(member._id) avatar_text: [member.first_name, member.last_name].filter((n) -> n?).map((n) -> n[0]).join "" } - console.log "REFRESHED USERS", $scope.project.members, $scope.users $scope.$watch "project.members", (members) -> return if !members?