{"action":"created","comment":{"url":"https://api.github.com/repos/slidewiki/user-service/pulls/comments/146507838","pull_request_review_id":71457280,"id":146507838,"diff_hunk":"@@ -7,7 +7,8 @@ Atm we save the userid because just the delete operation for a user is restricte\n const jwt = require('jsonwebtoken'),\n   config = require('../configuration');\n \n-module.exports = {\n+const self = module.exports = {","path":"application/controllers/jwt.js","position":5,"original_position":5,"commit_id":"55538aa7c4d831a53c2f7b9b162111e9b24ae5d3","original_commit_id":"1c9eb72cc65cb0532386a63331161f0361faf299","user":{"login":"kprist","id":2527439,"avatar_url":"https://avatars1.githubusercontent.com/u/2527439?v=4","gravatar_id":"","url":"https://api.github.com/users/kprist","html_url":"https://github.com/kprist","followers_url":"https://api.github.com/users/kprist/followers","following_url":"https://api.github.com/users/kprist/following{/other_user}","gists_url":"https://api.github.com/users/kprist/gists{/gist_id}","starred_url":"https://api.github.com/users/kprist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kprist/subscriptions","organizations_url":"https://api.github.com/users/kprist/orgs","repos_url":"https://api.github.com/users/kprist/repos","events_url":"https://api.github.com/users/kprist/events{/privacy}","received_events_url":"https://api.github.com/users/kprist/received_events","type":"User","site_admin":false},"body":"@rmeissn `this` would not work, as it depends where it's bound. For this particular example, `this` would refer to the global object, not the module. I could however override `this`, e.g. with ```\r\nlet createToken = jwt.createToken.bind(anyObjectHere);\r\ncreateToken(user);\r\n```\r\nwhich would break the code. Using `const self` which is a local (private) variable in the file makes sure `self` is always the module exports.","created_at":"2017-10-24T09:48:15Z","updated_at":"2017-10-24T09:48:15Z","html_url":"https://github.com/slidewiki/user-service/pull/37#discussion_r146507838","pull_request_url":"https://api.github.com/repos/slidewiki/user-service/pulls/37","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/slidewiki/user-service/pulls/comments/146507838"},"html":{"href":"https://github.com/slidewiki/user-service/pull/37#discussion_r146507838"},"pull_request":{"href":"https://api.github.com/repos/slidewiki/user-service/pulls/37"}},"in_reply_to_id":145906290},"pull_request":{"url":"https://api.github.com/repos/slidewiki/user-service/pulls/37","id":147504674,"html_url":"https://github.com/slidewiki/user-service/pull/37","diff_url":"https://github.com/slidewiki/user-service/pull/37.diff","patch_url":"https://github.com/slidewiki/user-service/pull/37.patch","issue_url":"https://api.github.com/repos/slidewiki/user-service/issues/37","number":37,"state":"open","locked":false,"title":"Add email in jwt token encoded user info","user":{"login":"kprist","id":2527439,"avatar_url":"https://avatars1.githubusercontent.com/u/2527439?v=4","gravatar_id":"","url":"https://api.github.com/users/kprist","html_url":"https://github.com/kprist","followers_url":"https://api.github.com/users/kprist/followers","following_url":"https://api.github.com/users/kprist/following{/other_user}","gists_url":"https://api.github.com/users/kprist/gists{/gist_id}","starred_url":"https://api.github.com/users/kprist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kprist/subscriptions","organizations_url":"https://api.github.com/users/kprist/orgs","repos_url":"https://api.github.com/users/kprist/repos","events_url":"https://api.github.com/users/kprist/events{/privacy}","received_events_url":"https://api.github.com/users/kprist/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-10-19T09:17:06Z","updated_at":"2017-10-24T09:48:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8e4ba37c57e93025c4d9d29d21faf10a5af0777c","assignee":{"login":"rmeissn","id":855967,"avatar_url":"https://avatars2.githubusercontent.com/u/855967?v=4","gravatar_id":"","url":"https://api.github.com/users/rmeissn","html_url":"https://github.com/rmeissn","followers_url":"https://api.github.com/users/rmeissn/followers","following_url":"https://api.github.com/users/rmeissn/following{/other_user}","gists_url":"https://api.github.com/users/rmeissn/gists{/gist_id}","starred_url":"https://api.github.com/users/rmeissn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmeissn/subscriptions","organizations_url":"https://api.github.com/users/rmeissn/orgs","repos_url":"https://api.github.com/users/rmeissn/repos","events_url":"https://api.github.com/users/rmeissn/events{/privacy}","received_events_url":"https://api.github.com/users/rmeissn/received_events","type":"User","site_admin":false},"assignees":[{"login":"rmeissn","id":855967,"avatar_url":"https://avatars2.githubusercontent.com/u/855967?v=4","gravatar_id":"","url":"https://api.github.com/users/rmeissn","html_url":"https://github.com/rmeissn","followers_url":"https://api.github.com/users/rmeissn/followers","following_url":"https://api.github.com/users/rmeissn/following{/other_user}","gists_url":"https://api.github.com/users/rmeissn/gists{/gist_id}","starred_url":"https://api.github.com/users/rmeissn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmeissn/subscriptions","organizations_url":"https://api.github.com/users/rmeissn/orgs","repos_url":"https://api.github.com/users/rmeissn/repos","events_url":"https://api.github.com/users/rmeissn/events{/privacy}","received_events_url":"https://api.github.com/users/rmeissn/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/slidewiki/user-service/pulls/37/commits","review_comments_url":"https://api.github.com/repos/slidewiki/user-service/pulls/37/comments","review_comment_url":"https://api.github.com/repos/slidewiki/user-service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/slidewiki/user-service/issues/37/comments","statuses_url":"https://api.github.com/repos/slidewiki/user-service/statuses/55538aa7c4d831a53c2f7b9b162111e9b24ae5d3","head":{"label":"slidewiki:SWIK-1795_Add-email-in-JWT-encoded-user-info","ref":"SWIK-1795_Add-email-in-JWT-encoded-user-info","sha":"55538aa7c4d831a53c2f7b9b162111e9b24ae5d3","user":{"login":"slidewiki","id":16650126,"avatar_url":"https://avatars3.githubusercontent.com/u/16650126?v=4","gravatar_id":"","url":"https://api.github.com/users/slidewiki","html_url":"https://github.com/slidewiki","followers_url":"https://api.github.com/users/slidewiki/followers","following_url":"https://api.github.com/users/slidewiki/following{/other_user}","gists_url":"https://api.github.com/users/slidewiki/gists{/gist_id}","starred_url":"https://api.github.com/users/slidewiki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slidewiki/subscriptions","organizations_url":"https://api.github.com/users/slidewiki/orgs","repos_url":"https://api.github.com/users/slidewiki/repos","events_url":"https://api.github.com/users/slidewiki/events{/privacy}","received_events_url":"https://api.github.com/users/slidewiki/received_events","type":"Organization","site_admin":false},"repo":{"id":62062956,"name":"user-service","full_name":"slidewiki/user-service","owner":{"login":"slidewiki","id":16650126,"avatar_url":"https://avatars3.githubusercontent.com/u/16650126?v=4","gravatar_id":"","url":"https://api.github.com/users/slidewiki","html_url":"https://github.com/slidewiki","followers_url":"https://api.github.com/users/slidewiki/followers","following_url":"https://api.github.com/users/slidewiki/following{/other_user}","gists_url":"https://api.github.com/users/slidewiki/gists{/gist_id}","starred_url":"https://api.github.com/users/slidewiki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slidewiki/subscriptions","organizations_url":"https://api.github.com/users/slidewiki/orgs","repos_url":"https://api.github.com/users/slidewiki/repos","events_url":"https://api.github.com/users/slidewiki/events{/privacy}","received_events_url":"https://api.github.com/users/slidewiki/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/slidewiki/user-service","description":"Manages user accounts. Used for credential login and user information management.","fork":false,"url":"https://api.github.com/repos/slidewiki/user-service","forks_url":"https://api.github.com/repos/slidewiki/user-service/forks","keys_url":"https://api.github.com/repos/slidewiki/user-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/slidewiki/user-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/slidewiki/user-service/teams","hooks_url":"https://api.github.com/repos/slidewiki/user-service/hooks","issue_events_url":"https://api.github.com/repos/slidewiki/user-service/issues/events{/number}","events_url":"https://api.github.com/repos/slidewiki/user-service/events","assignees_url":"https://api.github.com/repos/slidewiki/user-service/assignees{/user}","branches_url":"https://api.github.com/repos/slidewiki/user-service/branches{/branch}","tags_url":"https://api.github.com/repos/slidewiki/user-service/tags","blobs_url":"https://api.github.com/repos/slidewiki/user-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/slidewiki/user-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/slidewiki/user-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/slidewiki/user-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/slidewiki/user-service/statuses/{sha}","languages_url":"https://api.github.com/repos/slidewiki/user-service/languages","stargazers_url":"https://api.github.com/repos/slidewiki/user-service/stargazers","contributors_url":"https://api.github.com/repos/slidewiki/user-service/contributors","subscribers_url":"https://api.github.com/repos/slidewiki/user-service/subscribers","subscription_url":"https://api.github.com/repos/slidewiki/user-service/subscription","commits_url":"https://api.github.com/repos/slidewiki/user-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/slidewiki/user-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/slidewiki/user-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/slidewiki/user-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/slidewiki/user-service/contents/{+path}","compare_url":"https://api.github.com/repos/slidewiki/user-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/slidewiki/user-service/merges","archive_url":"https://api.github.com/repos/slidewiki/user-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/slidewiki/user-service/downloads","issues_url":"https://api.github.com/repos/slidewiki/user-service/issues{/number}","pulls_url":"https://api.github.com/repos/slidewiki/user-service/pulls{/number}","milestones_url":"https://api.github.com/repos/slidewiki/user-service/milestones{/number}","notifications_url":"https://api.github.com/repos/slidewiki/user-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/slidewiki/user-service/labels{/name}","releases_url":"https://api.github.com/repos/slidewiki/user-service/releases{/id}","deployments_url":"https://api.github.com/repos/slidewiki/user-service/deployments","created_at":"2016-06-27T14:36:36Z","updated_at":"2016-06-27T14:38:12Z","pushed_at":"2017-10-20T10:15:42Z","git_url":"git://github.com/slidewiki/user-service.git","ssh_url":"git@github.com:slidewiki/user-service.git","clone_url":"https://github.com/slidewiki/user-service.git","svn_url":"https://github.com/slidewiki/user-service","homepage":null,"size":587,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":5,"forks":1,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"slidewiki:master","ref":"master","sha":"ecd17eedad3ae0bd9748c68ec85cfed4f8e69672","user":{"login":"slidewiki","id":16650126,"avatar_url":"https://avatars3.githubusercontent.com/u/16650126?v=4","gravatar_id":"","url":"https://api.github.com/users/slidewiki","html_url":"https://github.com/slidewiki","followers_url":"https://api.github.com/users/slidewiki/followers","following_url":"https://api.github.com/users/slidewiki/following{/other_user}","gists_url":"https://api.github.com/users/slidewiki/gists{/gist_id}","starred_url":"https://api.github.com/users/slidewiki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slidewiki/subscriptions","organizations_url":"https://api.github.com/users/slidewiki/orgs","repos_url":"https://api.github.com/users/slidewiki/repos","events_url":"https://api.github.com/users/slidewiki/events{/privacy}","received_events_url":"https://api.github.com/users/slidewiki/received_events","type":"Organization","site_admin":false},"repo":{"id":62062956,"name":"user-service","full_name":"slidewiki/user-service","owner":{"login":"slidewiki","id":16650126,"avatar_url":"https://avatars3.githubusercontent.com/u/16650126?v=4","gravatar_id":"","url":"https://api.github.com/users/slidewiki","html_url":"https://github.com/slidewiki","followers_url":"https://api.github.com/users/slidewiki/followers","following_url":"https://api.github.com/users/slidewiki/following{/other_user}","gists_url":"https://api.github.com/users/slidewiki/gists{/gist_id}","starred_url":"https://api.github.com/users/slidewiki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slidewiki/subscriptions","organizations_url":"https://api.github.com/users/slidewiki/orgs","repos_url":"https://api.github.com/users/slidewiki/repos","events_url":"https://api.github.com/users/slidewiki/events{/privacy}","received_events_url":"https://api.github.com/users/slidewiki/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/slidewiki/user-service","description":"Manages user accounts. Used for credential login and user information management.","fork":false,"url":"https://api.github.com/repos/slidewiki/user-service","forks_url":"https://api.github.com/repos/slidewiki/user-service/forks","keys_url":"https://api.github.com/repos/slidewiki/user-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/slidewiki/user-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/slidewiki/user-service/teams","hooks_url":"https://api.github.com/repos/slidewiki/user-service/hooks","issue_events_url":"https://api.github.com/repos/slidewiki/user-service/issues/events{/number}","events_url":"https://api.github.com/repos/slidewiki/user-service/events","assignees_url":"https://api.github.com/repos/slidewiki/user-service/assignees{/user}","branches_url":"https://api.github.com/repos/slidewiki/user-service/branches{/branch}","tags_url":"https://api.github.com/repos/slidewiki/user-service/tags","blobs_url":"https://api.github.com/repos/slidewiki/user-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/slidewiki/user-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/slidewiki/user-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/slidewiki/user-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/slidewiki/user-service/statuses/{sha}","languages_url":"https://api.github.com/repos/slidewiki/user-service/languages","stargazers_url":"https://api.github.com/repos/slidewiki/user-service/stargazers","contributors_url":"https://api.github.com/repos/slidewiki/user-service/contributors","subscribers_url":"https://api.github.com/repos/slidewiki/user-service/subscribers","subscription_url":"https://api.github.com/repos/slidewiki/user-service/subscription","commits_url":"https://api.github.com/repos/slidewiki/user-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/slidewiki/user-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/slidewiki/user-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/slidewiki/user-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/slidewiki/user-service/contents/{+path}","compare_url":"https://api.github.com/repos/slidewiki/user-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/slidewiki/user-service/merges","archive_url":"https://api.github.com/repos/slidewiki/user-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/slidewiki/user-service/downloads","issues_url":"https://api.github.com/repos/slidewiki/user-service/issues{/number}","pulls_url":"https://api.github.com/repos/slidewiki/user-service/pulls{/number}","milestones_url":"https://api.github.com/repos/slidewiki/user-service/milestones{/number}","notifications_url":"https://api.github.com/repos/slidewiki/user-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/slidewiki/user-service/labels{/name}","releases_url":"https://api.github.com/repos/slidewiki/user-service/releases{/id}","deployments_url":"https://api.github.com/repos/slidewiki/user-service/deployments","created_at":"2016-06-27T14:36:36Z","updated_at":"2016-06-27T14:38:12Z","pushed_at":"2017-10-20T10:15:42Z","git_url":"git://github.com/slidewiki/user-service.git","ssh_url":"git@github.com:slidewiki/user-service.git","clone_url":"https://github.com/slidewiki/user-service.git","svn_url":"https://github.com/slidewiki/user-service","homepage":null,"size":587,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":5,"forks":1,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/slidewiki/user-service/pulls/37"},"html":{"href":"https://github.com/slidewiki/user-service/pull/37"},"issue":{"href":"https://api.github.com/repos/slidewiki/user-service/issues/37"},"comments":{"href":"https://api.github.com/repos/slidewiki/user-service/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/slidewiki/user-service/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/slidewiki/user-service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/slidewiki/user-service/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/slidewiki/user-service/statuses/55538aa7c4d831a53c2f7b9b162111e9b24ae5d3"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"kprist"}}