{"action":"created","comment":{"url":"https://api.github.com/repos/Trustroots/trustroots/pulls/comments/233267591","pull_request_review_id":174642736,"id":233267591,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzI2NzU5MQ==","diff_hunk":"@@ -326,3 +326,65 @@ exports.readMany = function readMany(req, res, next) {\n \n   ], processResponses.bind(this, res, next));\n };\n+\n+\n+/**\n+ * Validator for id of referenceById controller\n+ * @param {string} id - referenceId\n+ */\n+function validateReadOne(id) {\n+  var valid = true;\n+  var details = [];\n+\n+  var isIdValid = mongoose.Types.ObjectId.isValid(id);\n+  if (!isIdValid) {\n+    valid = false;\n+    details.push('Invalid referenceId.');\n+  }\n+\n+  return { valid: valid, details: details };\n+}\n+\n+/**\n+ * Load a reference by id to request.reference\n+ */\n+exports.referenceById = function referenceById(req, res, next, id) { // eslint-disable-line no-unused-vars\n+  // don't bother fetching a reference for non-public users or guests\n+  if (!req.user || !req.user.public) return next();\n+\n+  async.waterfall([\n+    // validate\n+    validate.bind(this, validateReadOne, id),\n+    // find the reference by id\n+    function (cb) {\n+      Reference.findById(req.params.referenceId)\n+        .select(referenceFields)\n+        .populate('userFrom userTo', userProfile.userMiniProfileFields)\n+        .exec(cb);\n+    },\n+    function (reference, cb) {","path":"modules/references/server/controllers/reference.server.controller.js","position":90,"original_position":40,"commit_id":"e200d87b21321dd22c89abbfd013e5bdf15e1371","original_commit_id":"7da76958daa605ab4bdb0a27476c663277b7930a","user":{"login":"mrkvon","id":7449720,"node_id":"MDQ6VXNlcjc0NDk3MjA=","avatar_url":"https://avatars0.githubusercontent.com/u/7449720?v=4","gravatar_id":"","url":"https://api.github.com/users/mrkvon","html_url":"https://github.com/mrkvon","followers_url":"https://api.github.com/users/mrkvon/followers","following_url":"https://api.github.com/users/mrkvon/following{/other_user}","gists_url":"https://api.github.com/users/mrkvon/gists{/gist_id}","starred_url":"https://api.github.com/users/mrkvon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrkvon/subscriptions","organizations_url":"https://api.github.com/users/mrkvon/orgs","repos_url":"https://api.github.com/users/mrkvon/repos","events_url":"https://api.github.com/users/mrkvon/events{/privacy}","received_events_url":"https://api.github.com/users/mrkvon/received_events","type":"User","site_admin":false},"body":"different comment already added","created_at":"2018-11-13T23:50:17Z","updated_at":"2018-11-13T23:50:17Z","html_url":"https://github.com/Trustroots/trustroots/pull/761#discussion_r233267591","pull_request_url":"https://api.github.com/repos/Trustroots/trustroots/pulls/761","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Trustroots/trustroots/pulls/comments/233267591"},"html":{"href":"https://github.com/Trustroots/trustroots/pull/761#discussion_r233267591"},"pull_request":{"href":"https://api.github.com/repos/Trustroots/trustroots/pulls/761"}},"in_reply_to_id":227719414},"pull_request":{"url":"https://api.github.com/repos/Trustroots/trustroots/pulls/761","id":224872705,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0ODcyNzA1","html_url":"https://github.com/Trustroots/trustroots/pull/761","diff_url":"https://github.com/Trustroots/trustroots/pull/761.diff","patch_url":"https://github.com/Trustroots/trustroots/pull/761.patch","issue_url":"https://api.github.com/repos/Trustroots/trustroots/issues/761","number":761,"state":"open","locked":false,"title":"Read reference by id (API)","user":{"login":"mrkvon","id":7449720,"node_id":"MDQ6VXNlcjc0NDk3MjA=","avatar_url":"https://avatars0.githubusercontent.com/u/7449720?v=4","gravatar_id":"","url":"https://api.github.com/users/mrkvon","html_url":"https://github.com/mrkvon","followers_url":"https://api.github.com/users/mrkvon/followers","following_url":"https://api.github.com/users/mrkvon/following{/other_user}","gists_url":"https://api.github.com/users/mrkvon/gists{/gist_id}","starred_url":"https://api.github.com/users/mrkvon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrkvon/subscriptions","organizations_url":"https://api.github.com/users/mrkvon/orgs","repos_url":"https://api.github.com/users/mrkvon/repos","events_url":"https://api.github.com/users/mrkvon/events{/privacy}","received_events_url":"https://api.github.com/users/mrkvon/received_events","type":"User","site_admin":false},"body":"`GET /api/references/:referenceId`\r\n\r\nContinued work on #718 \r\nDepends on #759 and #723 ","created_at":"2018-10-23T02:20:22Z","updated_at":"2018-11-13T23:50:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b0381450d522144bfd0f14938b3f8ed6b104bae8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1094129801,"node_id":"MDU6TGFiZWwxMDk0MTI5ODAx","url":"https://api.github.com/repos/Trustroots/trustroots/labels/Module:References","name":"Module:References","color":"ffffff","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Trustroots/trustroots/pulls/761/commits","review_comments_url":"https://api.github.com/repos/Trustroots/trustroots/pulls/761/comments","review_comment_url":"https://api.github.com/repos/Trustroots/trustroots/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Trustroots/trustroots/issues/761/comments","statuses_url":"https://api.github.com/repos/Trustroots/trustroots/statuses/e200d87b21321dd22c89abbfd013e5bdf15e1371","head":{"label":"Trustroots:reference-read-api","ref":"reference-read-api","sha":"e200d87b21321dd22c89abbfd013e5bdf15e1371","user":{"login":"Trustroots","id":8582302,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1ODIzMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/8582302?v=4","gravatar_id":"","url":"https://api.github.com/users/Trustroots","html_url":"https://github.com/Trustroots","followers_url":"https://api.github.com/users/Trustroots/followers","following_url":"https://api.github.com/users/Trustroots/following{/other_user}","gists_url":"https://api.github.com/users/Trustroots/gists{/gist_id}","starred_url":"https://api.github.com/users/Trustroots/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trustroots/subscriptions","organizations_url":"https://api.github.com/users/Trustroots/orgs","repos_url":"https://api.github.com/users/Trustroots/repos","events_url":"https://api.github.com/users/Trustroots/events{/privacy}","received_events_url":"https://api.github.com/users/Trustroots/received_events","type":"Organization","site_admin":false},"repo":{"id":24712181,"node_id":"MDEwOlJlcG9zaXRvcnkyNDcxMjE4MQ==","name":"trustroots","full_name":"Trustroots/trustroots","private":false,"owner":{"login":"Trustroots","id":8582302,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1ODIzMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/8582302?v=4","gravatar_id":"","url":"https://api.github.com/users/Trustroots","html_url":"https://github.com/Trustroots","followers_url":"https://api.github.com/users/Trustroots/followers","following_url":"https://api.github.com/users/Trustroots/following{/other_user}","gists_url":"https://api.github.com/users/Trustroots/gists{/gist_id}","starred_url":"https://api.github.com/users/Trustroots/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trustroots/subscriptions","organizations_url":"https://api.github.com/users/Trustroots/orgs","repos_url":"https://api.github.com/users/Trustroots/repos","events_url":"https://api.github.com/users/Trustroots/events{/privacy}","received_events_url":"https://api.github.com/users/Trustroots/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Trustroots/trustroots","description":"Travellers' community for sharing, hosting and getting people together.","fork":false,"url":"https://api.github.com/repos/Trustroots/trustroots","forks_url":"https://api.github.com/repos/Trustroots/trustroots/forks","keys_url":"https://api.github.com/repos/Trustroots/trustroots/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Trustroots/trustroots/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Trustroots/trustroots/teams","hooks_url":"https://api.github.com/repos/Trustroots/trustroots/hooks","issue_events_url":"https://api.github.com/repos/Trustroots/trustroots/issues/events{/number}","events_url":"https://api.github.com/repos/Trustroots/trustroots/events","assignees_url":"https://api.github.com/repos/Trustroots/trustroots/assignees{/user}","branches_url":"https://api.github.com/repos/Trustroots/trustroots/branches{/branch}","tags_url":"https://api.github.com/repos/Trustroots/trustroots/tags","blobs_url":"https://api.github.com/repos/Trustroots/trustroots/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Trustroots/trustroots/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Trustroots/trustroots/git/refs{/sha}","trees_url":"https://api.github.com/repos/Trustroots/trustroots/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Trustroots/trustroots/statuses/{sha}","languages_url":"https://api.github.com/repos/Trustroots/trustroots/languages","stargazers_url":"https://api.github.com/repos/Trustroots/trustroots/stargazers","contributors_url":"https://api.github.com/repos/Trustroots/trustroots/contributors","subscribers_url":"https://api.github.com/repos/Trustroots/trustroots/subscribers","subscription_url":"https://api.github.com/repos/Trustroots/trustroots/subscription","commits_url":"https://api.github.com/repos/Trustroots/trustroots/commits{/sha}","git_commits_url":"https://api.github.com/repos/Trustroots/trustroots/git/commits{/sha}","comments_url":"https://api.github.com/repos/Trustroots/trustroots/comments{/number}","issue_comment_url":"https://api.github.com/repos/Trustroots/trustroots/issues/comments{/number}","contents_url":"https://api.github.com/repos/Trustroots/trustroots/contents/{+path}","compare_url":"https://api.github.com/repos/Trustroots/trustroots/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Trustroots/trustroots/merges","archive_url":"https://api.github.com/repos/Trustroots/trustroots/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Trustroots/trustroots/downloads","issues_url":"https://api.github.com/repos/Trustroots/trustroots/issues{/number}","pulls_url":"https://api.github.com/repos/Trustroots/trustroots/pulls{/number}","milestones_url":"https://api.github.com/repos/Trustroots/trustroots/milestones{/number}","notifications_url":"https://api.github.com/repos/Trustroots/trustroots/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Trustroots/trustroots/labels{/name}","releases_url":"https://api.github.com/repos/Trustroots/trustroots/releases{/id}","deployments_url":"https://api.github.com/repos/Trustroots/trustroots/deployments","created_at":"2014-10-02T08:38:46Z","updated_at":"2018-11-13T23:24:23Z","pushed_at":"2018-11-13T23:48:00Z","git_url":"git://github.com/Trustroots/trustroots.git","ssh_url":"git@github.com:Trustroots/trustroots.git","clone_url":"https://github.com/Trustroots/trustroots.git","svn_url":"https://github.com/Trustroots/trustroots","homepage":"https://www.trustroots.org","size":23776,"stargazers_count":204,"watchers_count":204,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":93,"mirror_url":null,"archived":false,"open_issues_count":135,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":93,"open_issues":135,"watchers":204,"default_branch":"master"}},"base":{"label":"Trustroots:master","ref":"master","sha":"018cd6996f9bfe4ce390b2cce2562196edab3e59","user":{"login":"Trustroots","id":8582302,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1ODIzMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/8582302?v=4","gravatar_id":"","url":"https://api.github.com/users/Trustroots","html_url":"https://github.com/Trustroots","followers_url":"https://api.github.com/users/Trustroots/followers","following_url":"https://api.github.com/users/Trustroots/following{/other_user}","gists_url":"https://api.github.com/users/Trustroots/gists{/gist_id}","starred_url":"https://api.github.com/users/Trustroots/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trustroots/subscriptions","organizations_url":"https://api.github.com/users/Trustroots/orgs","repos_url":"https://api.github.com/users/Trustroots/repos","events_url":"https://api.github.com/users/Trustroots/events{/privacy}","received_events_url":"https://api.github.com/users/Trustroots/received_events","type":"Organization","site_admin":false},"repo":{"id":24712181,"node_id":"MDEwOlJlcG9zaXRvcnkyNDcxMjE4MQ==","name":"trustroots","full_name":"Trustroots/trustroots","private":false,"owner":{"login":"Trustroots","id":8582302,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1ODIzMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/8582302?v=4","gravatar_id":"","url":"https://api.github.com/users/Trustroots","html_url":"https://github.com/Trustroots","followers_url":"https://api.github.com/users/Trustroots/followers","following_url":"https://api.github.com/users/Trustroots/following{/other_user}","gists_url":"https://api.github.com/users/Trustroots/gists{/gist_id}","starred_url":"https://api.github.com/users/Trustroots/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trustroots/subscriptions","organizations_url":"https://api.github.com/users/Trustroots/orgs","repos_url":"https://api.github.com/users/Trustroots/repos","events_url":"https://api.github.com/users/Trustroots/events{/privacy}","received_events_url":"https://api.github.com/users/Trustroots/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Trustroots/trustroots","description":"Travellers' community for sharing, hosting and getting people together.","fork":false,"url":"https://api.github.com/repos/Trustroots/trustroots","forks_url":"https://api.github.com/repos/Trustroots/trustroots/forks","keys_url":"https://api.github.com/repos/Trustroots/trustroots/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Trustroots/trustroots/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Trustroots/trustroots/teams","hooks_url":"https://api.github.com/repos/Trustroots/trustroots/hooks","issue_events_url":"https://api.github.com/repos/Trustroots/trustroots/issues/events{/number}","events_url":"https://api.github.com/repos/Trustroots/trustroots/events","assignees_url":"https://api.github.com/repos/Trustroots/trustroots/assignees{/user}","branches_url":"https://api.github.com/repos/Trustroots/trustroots/branches{/branch}","tags_url":"https://api.github.com/repos/Trustroots/trustroots/tags","blobs_url":"https://api.github.com/repos/Trustroots/trustroots/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Trustroots/trustroots/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Trustroots/trustroots/git/refs{/sha}","trees_url":"https://api.github.com/repos/Trustroots/trustroots/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Trustroots/trustroots/statuses/{sha}","languages_url":"https://api.github.com/repos/Trustroots/trustroots/languages","stargazers_url":"https://api.github.com/repos/Trustroots/trustroots/stargazers","contributors_url":"https://api.github.com/repos/Trustroots/trustroots/contributors","subscribers_url":"https://api.github.com/repos/Trustroots/trustroots/subscribers","subscription_url":"https://api.github.com/repos/Trustroots/trustroots/subscription","commits_url":"https://api.github.com/repos/Trustroots/trustroots/commits{/sha}","git_commits_url":"https://api.github.com/repos/Trustroots/trustroots/git/commits{/sha}","comments_url":"https://api.github.com/repos/Trustroots/trustroots/comments{/number}","issue_comment_url":"https://api.github.com/repos/Trustroots/trustroots/issues/comments{/number}","contents_url":"https://api.github.com/repos/Trustroots/trustroots/contents/{+path}","compare_url":"https://api.github.com/repos/Trustroots/trustroots/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Trustroots/trustroots/merges","archive_url":"https://api.github.com/repos/Trustroots/trustroots/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Trustroots/trustroots/downloads","issues_url":"https://api.github.com/repos/Trustroots/trustroots/issues{/number}","pulls_url":"https://api.github.com/repos/Trustroots/trustroots/pulls{/number}","milestones_url":"https://api.github.com/repos/Trustroots/trustroots/milestones{/number}","notifications_url":"https://api.github.com/repos/Trustroots/trustroots/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Trustroots/trustroots/labels{/name}","releases_url":"https://api.github.com/repos/Trustroots/trustroots/releases{/id}","deployments_url":"https://api.github.com/repos/Trustroots/trustroots/deployments","created_at":"2014-10-02T08:38:46Z","updated_at":"2018-11-13T23:24:23Z","pushed_at":"2018-11-13T23:48:00Z","git_url":"git://github.com/Trustroots/trustroots.git","ssh_url":"git@github.com:Trustroots/trustroots.git","clone_url":"https://github.com/Trustroots/trustroots.git","svn_url":"https://github.com/Trustroots/trustroots","homepage":"https://www.trustroots.org","size":23776,"stargazers_count":204,"watchers_count":204,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":93,"mirror_url":null,"archived":false,"open_issues_count":135,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":93,"open_issues":135,"watchers":204,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Trustroots/trustroots/pulls/761"},"html":{"href":"https://github.com/Trustroots/trustroots/pull/761"},"issue":{"href":"https://api.github.com/repos/Trustroots/trustroots/issues/761"},"comments":{"href":"https://api.github.com/repos/Trustroots/trustroots/issues/761/comments"},"review_comments":{"href":"https://api.github.com/repos/Trustroots/trustroots/pulls/761/comments"},"review_comment":{"href":"https://api.github.com/repos/Trustroots/trustroots/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Trustroots/trustroots/pulls/761/commits"},"statuses":{"href":"https://api.github.com/repos/Trustroots/trustroots/statuses/e200d87b21321dd22c89abbfd013e5bdf15e1371"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"mrkvon"}}