{"action":"created","comment":{"url":"https://api.github.com/repos/etcaterva/EchaloASuerte/pulls/comments/42404870","id":42404870,"diff_hunk":"@@ -119,29 +119,32 @@ def chat(self, request, **kwargs):\n                 data = json.loads(request.body.decode('utf-8'))\n             try:\n                 message = data['message']\n-                user = data['user']\n-                self._client.add_chat_message(draw_id, message, user)\n+                user_id = data['user']\n+                self._client.add_chat_message(draw_id, message, user_id)\n             except KeyError:\n                 raise exceptions.ImmediateHttpResponse(\n                     response=http.HttpBadRequest(\"Missing message or username\"))\n             return self.create_response(request, {})\n         elif request.method == 'GET':\n             # TODO: return only the list of messages\n-            def get_user_image(username):\n+            def get_user_details(username):\n                 \"\"\"function to get either the user avatar or an empty string\"\"\"\n                 try:\n-                    return self._client.retrieve_user(username).user_image\n+                    user = self._client.retrieve_user(username)\n                 except Exception:\n                     return \"\"\n+                else:\n+                    return {\"alias\": user.alias, \"avatar\": user.user_image}\n             try:\n                 messages = self._client.retrieve_chat_messages(draw_id)\n             except mongodb.MongoDriver.NotFoundError:\n                 messages = []\n \n             users = set([message[\"user\"] for message in messages])\n-            users_map = {name: get_user_image(name) for name in users}\n+            users_map = {name: get_user_details(name) for name in users}","path":"web/rest_api/draw.py","position":31,"original_position":31,"commit_id":"d9d2116bc47d86667b2303de4a5a3f999c26d72d","original_commit_id":"d9d2116bc47d86667b2303de4a5a3f999c26d72d","user":{"login":"Mariocj89","id":3709683,"avatar_url":"https://avatars.githubusercontent.com/u/3709683?v=3","gravatar_id":"","url":"https://api.github.com/users/Mariocj89","html_url":"https://github.com/Mariocj89","followers_url":"https://api.github.com/users/Mariocj89/followers","following_url":"https://api.github.com/users/Mariocj89/following{/other_user}","gists_url":"https://api.github.com/users/Mariocj89/gists{/gist_id}","starred_url":"https://api.github.com/users/Mariocj89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mariocj89/subscriptions","organizations_url":"https://api.github.com/users/Mariocj89/orgs","repos_url":"https://api.github.com/users/Mariocj89/repos","events_url":"https://api.github.com/users/Mariocj89/events{/privacy}","received_events_url":"https://api.github.com/users/Mariocj89/received_events","type":"User","site_admin":false},"body":"name is going to be a dict with alias an avatar??? isnt that weird?","created_at":"2015-10-19T18:05:03Z","updated_at":"2015-10-19T18:05:03Z","html_url":"https://github.com/etcaterva/EchaloASuerte/pull/506#discussion_r42404870","pull_request_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/pulls/506","_links":{"self":{"href":"https://api.github.com/repos/etcaterva/EchaloASuerte/pulls/comments/42404870"},"html":{"href":"https://github.com/etcaterva/EchaloASuerte/pull/506#discussion_r42404870"},"pull_request":{"href":"https://api.github.com/repos/etcaterva/EchaloASuerte/pulls/506"}}},"pull_request":{"url":"https://api.github.com/repos/etcaterva/EchaloASuerte/pulls/506","id":47952514,"html_url":"https://github.com/etcaterva/EchaloASuerte/pull/506","diff_url":"https://github.com/etcaterva/EchaloASuerte/pull/506.diff","patch_url":"https://github.com/etcaterva/EchaloASuerte/pull/506.patch","issue_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/issues/506","number":506,"state":"open","locked":false,"title":"Chat with api","user":{"login":"dnaranjo89","id":9324508,"avatar_url":"https://avatars.githubusercontent.com/u/9324508?v=3","gravatar_id":"","url":"https://api.github.com/users/dnaranjo89","html_url":"https://github.com/dnaranjo89","followers_url":"https://api.github.com/users/dnaranjo89/followers","following_url":"https://api.github.com/users/dnaranjo89/following{/other_user}","gists_url":"https://api.github.com/users/dnaranjo89/gists{/gist_id}","starred_url":"https://api.github.com/users/dnaranjo89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnaranjo89/subscriptions","organizations_url":"https://api.github.com/users/dnaranjo89/orgs","repos_url":"https://api.github.com/users/dnaranjo89/repos","events_url":"https://api.github.com/users/dnaranjo89/events{/privacy}","received_events_url":"https://api.github.com/users/dnaranjo89/received_events","type":"User","site_admin":false},"body":"Use the API to fetch and send chat messages\r\n\r\nReturn the alias in the entries of the chat (in addition of the user_id, avatar and message)","created_at":"2015-10-16T19:50:53Z","updated_at":"2015-10-19T18:05:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6afcd0bcb98e642fa8fb58dd18f94fde038aa216","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/pulls/506/commits","review_comments_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/pulls/506/comments","review_comment_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/pulls/comments{/number}","comments_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/issues/506/comments","statuses_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/statuses/d9d2116bc47d86667b2303de4a5a3f999c26d72d","head":{"label":"dnaranjo89:chat_with_api","ref":"chat_with_api","sha":"d9d2116bc47d86667b2303de4a5a3f999c26d72d","user":{"login":"dnaranjo89","id":9324508,"avatar_url":"https://avatars.githubusercontent.com/u/9324508?v=3","gravatar_id":"","url":"https://api.github.com/users/dnaranjo89","html_url":"https://github.com/dnaranjo89","followers_url":"https://api.github.com/users/dnaranjo89/followers","following_url":"https://api.github.com/users/dnaranjo89/following{/other_user}","gists_url":"https://api.github.com/users/dnaranjo89/gists{/gist_id}","starred_url":"https://api.github.com/users/dnaranjo89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnaranjo89/subscriptions","organizations_url":"https://api.github.com/users/dnaranjo89/orgs","repos_url":"https://api.github.com/users/dnaranjo89/repos","events_url":"https://api.github.com/users/dnaranjo89/events{/privacy}","received_events_url":"https://api.github.com/users/dnaranjo89/received_events","type":"User","site_admin":false},"repo":{"id":31869154,"name":"EchaloASuerte","full_name":"dnaranjo89/EchaloASuerte","owner":{"login":"dnaranjo89","id":9324508,"avatar_url":"https://avatars.githubusercontent.com/u/9324508?v=3","gravatar_id":"","url":"https://api.github.com/users/dnaranjo89","html_url":"https://github.com/dnaranjo89","followers_url":"https://api.github.com/users/dnaranjo89/followers","following_url":"https://api.github.com/users/dnaranjo89/following{/other_user}","gists_url":"https://api.github.com/users/dnaranjo89/gists{/gist_id}","starred_url":"https://api.github.com/users/dnaranjo89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnaranjo89/subscriptions","organizations_url":"https://api.github.com/users/dnaranjo89/orgs","repos_url":"https://api.github.com/users/dnaranjo89/repos","events_url":"https://api.github.com/users/dnaranjo89/events{/privacy}","received_events_url":"https://api.github.com/users/dnaranjo89/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dnaranjo89/EchaloASuerte","description":"","fork":true,"url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte","forks_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/forks","keys_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/teams","hooks_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/hooks","issue_events_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/issues/events{/number}","events_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/events","assignees_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/assignees{/user}","branches_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/branches{/branch}","tags_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/tags","blobs_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/git/refs{/sha}","trees_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/statuses/{sha}","languages_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/languages","stargazers_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/stargazers","contributors_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/contributors","subscribers_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/subscribers","subscription_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/subscription","commits_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/commits{/sha}","git_commits_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/git/commits{/sha}","comments_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/comments{/number}","issue_comment_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/issues/comments{/number}","contents_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/contents/{+path}","compare_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/merges","archive_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/downloads","issues_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/issues{/number}","pulls_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/pulls{/number}","milestones_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/milestones{/number}","notifications_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/labels{/name}","releases_url":"https://api.github.com/repos/dnaranjo89/EchaloASuerte/releases{/id}","created_at":"2015-03-08T22:55:28Z","updated_at":"2015-09-21T10:28:34Z","pushed_at":"2015-10-16T19:48:34Z","git_url":"git://github.com/dnaranjo89/EchaloASuerte.git","ssh_url":"git@github.com:dnaranjo89/EchaloASuerte.git","clone_url":"https://github.com/dnaranjo89/EchaloASuerte.git","svn_url":"https://github.com/dnaranjo89/EchaloASuerte","homepage":null,"size":7050,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"etcaterva:master","ref":"master","sha":"c6de9406b664c8eaf69d72c69a5aab6f0575604f","user":{"login":"etcaterva","id":11301498,"avatar_url":"https://avatars.githubusercontent.com/u/11301498?v=3","gravatar_id":"","url":"https://api.github.com/users/etcaterva","html_url":"https://github.com/etcaterva","followers_url":"https://api.github.com/users/etcaterva/followers","following_url":"https://api.github.com/users/etcaterva/following{/other_user}","gists_url":"https://api.github.com/users/etcaterva/gists{/gist_id}","starred_url":"https://api.github.com/users/etcaterva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etcaterva/subscriptions","organizations_url":"https://api.github.com/users/etcaterva/orgs","repos_url":"https://api.github.com/users/etcaterva/repos","events_url":"https://api.github.com/users/etcaterva/events{/privacy}","received_events_url":"https://api.github.com/users/etcaterva/received_events","type":"Organization","site_admin":false},"repo":{"id":23440601,"name":"EchaloASuerte","full_name":"etcaterva/EchaloASuerte","owner":{"login":"etcaterva","id":11301498,"avatar_url":"https://avatars.githubusercontent.com/u/11301498?v=3","gravatar_id":"","url":"https://api.github.com/users/etcaterva","html_url":"https://github.com/etcaterva","followers_url":"https://api.github.com/users/etcaterva/followers","following_url":"https://api.github.com/users/etcaterva/following{/other_user}","gists_url":"https://api.github.com/users/etcaterva/gists{/gist_id}","starred_url":"https://api.github.com/users/etcaterva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etcaterva/subscriptions","organizations_url":"https://api.github.com/users/etcaterva/orgs","repos_url":"https://api.github.com/users/etcaterva/repos","events_url":"https://api.github.com/users/etcaterva/events{/privacy}","received_events_url":"https://api.github.com/users/etcaterva/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/etcaterva/EchaloASuerte","description":"","fork":false,"url":"https://api.github.com/repos/etcaterva/EchaloASuerte","forks_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/forks","keys_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/keys{/key_id}","collaborators_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/teams","hooks_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/hooks","issue_events_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/issues/events{/number}","events_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/events","assignees_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/assignees{/user}","branches_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/branches{/branch}","tags_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/tags","blobs_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/git/refs{/sha}","trees_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/git/trees{/sha}","statuses_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/statuses/{sha}","languages_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/languages","stargazers_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/stargazers","contributors_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/contributors","subscribers_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/subscribers","subscription_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/subscription","commits_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/commits{/sha}","git_commits_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/git/commits{/sha}","comments_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/comments{/number}","issue_comment_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/issues/comments{/number}","contents_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/contents/{+path}","compare_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/compare/{base}...{head}","merges_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/merges","archive_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/downloads","issues_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/issues{/number}","pulls_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/pulls{/number}","milestones_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/milestones{/number}","notifications_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/labels{/name}","releases_url":"https://api.github.com/repos/etcaterva/EchaloASuerte/releases{/id}","created_at":"2014-08-28T19:40:10Z","updated_at":"2015-09-16T20:50:27Z","pushed_at":"2015-10-19T18:01:44Z","git_url":"git://github.com/etcaterva/EchaloASuerte.git","ssh_url":"git@github.com:etcaterva/EchaloASuerte.git","clone_url":"https://github.com/etcaterva/EchaloASuerte.git","svn_url":"https://github.com/etcaterva/EchaloASuerte","homepage":null,"size":8932,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":16,"forks":4,"open_issues":16,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/etcaterva/EchaloASuerte/pulls/506"},"html":{"href":"https://github.com/etcaterva/EchaloASuerte/pull/506"},"issue":{"href":"https://api.github.com/repos/etcaterva/EchaloASuerte/issues/506"},"comments":{"href":"https://api.github.com/repos/etcaterva/EchaloASuerte/issues/506/comments"},"review_comments":{"href":"https://api.github.com/repos/etcaterva/EchaloASuerte/pulls/506/comments"},"review_comment":{"href":"https://api.github.com/repos/etcaterva/EchaloASuerte/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/etcaterva/EchaloASuerte/pulls/506/commits"},"statuses":{"href":"https://api.github.com/repos/etcaterva/EchaloASuerte/statuses/d9d2116bc47d86667b2303de4a5a3f999c26d72d"}}}}