From 0aa6a206e7cdd11368c00efc62d5f4c4bcb81206 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 14 Jul 2014 16:23:21 +0100 Subject: [PATCH] added name and email to connected user data and example get request for chat --- .../Features/ConnectedUsers/ConnectedUsersManager.coffee | 2 ++ .../public/coffee/ide/chat/controllers/ChatController.coffee | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/services/web/app/coffee/Features/ConnectedUsers/ConnectedUsersManager.coffee b/services/web/app/coffee/Features/ConnectedUsers/ConnectedUsersManager.coffee index f838509d0a..6050dc982c 100644 --- a/services/web/app/coffee/Features/ConnectedUsers/ConnectedUsersManager.coffee +++ b/services/web/app/coffee/Features/ConnectedUsers/ConnectedUsersManager.coffee @@ -52,6 +52,8 @@ module.exports = result.user_id = user_id if result.cursorData? result.cursorData = JSON.parse(result.cursorData) + result.email = result.cursorData.email + result.name = result.cursorData.name callback err, result setUserCursorPosition: (project_id, user_id, cursorData, callback)-> diff --git a/services/web/public/coffee/ide/chat/controllers/ChatController.coffee b/services/web/public/coffee/ide/chat/controllers/ChatController.coffee index d9a41568d8..ff40b84c6d 100644 --- a/services/web/public/coffee/ide/chat/controllers/ChatController.coffee +++ b/services/web/public/coffee/ide/chat/controllers/ChatController.coffee @@ -3,6 +3,7 @@ define [ ], (App) -> App.controller "ChatController", ["$scope", "$http", "ide", "$location", ($scope, $http, @ide, $location) -> MESSAGES_URL = "/project/#{$scope.project_id}/messages" + CONNECTED_USER_URL = "/project/#{$scope.project_id}/connected_users" $scope.$on "project:joined", => @ide.socket.on "new-chat-message", (message) => @@ -11,6 +12,9 @@ define [ $http.get(MESSAGES_URL).success (data, status, headers, config)-> $scope.chat.messages = data + $http.get(CONNECTED_USER_URL).success (data)-> + console.log data + $scope.$watchCollection "chat.messages", (messages) -> if messages? console.log "grouping messages"