added name and email to connected user data and example get request for chat

This commit is contained in:
Henry Oswald 2014-07-14 16:23:21 +01:00
parent 4a71b38721
commit 0aa6a206e7
2 changed files with 6 additions and 0 deletions

View file

@ -52,6 +52,8 @@ module.exports =
result.user_id = user_id result.user_id = user_id
if result.cursorData? if result.cursorData?
result.cursorData = JSON.parse(result.cursorData) result.cursorData = JSON.parse(result.cursorData)
result.email = result.cursorData.email
result.name = result.cursorData.name
callback err, result callback err, result
setUserCursorPosition: (project_id, user_id, cursorData, callback)-> setUserCursorPosition: (project_id, user_id, cursorData, callback)->

View file

@ -3,6 +3,7 @@ define [
], (App) -> ], (App) ->
App.controller "ChatController", ["$scope", "$http", "ide", "$location", ($scope, $http, @ide, $location) -> App.controller "ChatController", ["$scope", "$http", "ide", "$location", ($scope, $http, @ide, $location) ->
MESSAGES_URL = "/project/#{$scope.project_id}/messages" MESSAGES_URL = "/project/#{$scope.project_id}/messages"
CONNECTED_USER_URL = "/project/#{$scope.project_id}/connected_users"
$scope.$on "project:joined", => $scope.$on "project:joined", =>
@ide.socket.on "new-chat-message", (message) => @ide.socket.on "new-chat-message", (message) =>
@ -11,6 +12,9 @@ define [
$http.get(MESSAGES_URL).success (data, status, headers, config)-> $http.get(MESSAGES_URL).success (data, status, headers, config)->
$scope.chat.messages = data $scope.chat.messages = data
$http.get(CONNECTED_USER_URL).success (data)->
console.log data
$scope.$watchCollection "chat.messages", (messages) -> $scope.$watchCollection "chat.messages", (messages) ->
if messages? if messages?
console.log "grouping messages" console.log "grouping messages"