GitHub PullRequestReviewCommentEvent at 2014-06-19 09:27:51
Repository: salesFetch
Actor: Neamar
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/AnyFetch/salesFetch/pulls/comments/13959508","id":13959508,"diff_hunk":"@@ -0,0 +1,123 @@\n+'use strict';\n+\n+var request = require('supertest');\n+var Mustache = require('mustache');\n+var async = require('async');\n+var querystring = require('querystring');\n+var rarity = require('rarity');\n+\n+var mongoose =require('mongoose');\n+var Pin = mongoose.model('Pin');\n+\n+var anyfetchHelpers = require('../helpers/anyfetch.js');\n+var config = require('../../config/configuration.js');\n+var fetchApiUrl = config.fetchApiUrl;\n+\n+module.exports.findPins = function(SFDCId, user, finalCb) {\n+  // Retrieve documents pinned to that context\n+  async.waterfall([\n+    function findPin(cb) {\n+      Pin.find({ SFDCId: SFDCId }, cb);\n+    },\n+    // Fetch all snippets in one call\n+    function fetchDocumentsAndDocumentTypes(pins, cb) {\n+      // Fetch all snippets in one call\n+      var ids = pins.map(function(pin) {\n+        return pin.anyFetchId;\n+      });\n+\n+      // Batch call: /documents and /document_types\n+      var pages = [\n+        '/documents?' + querystring.encode({ id: ids}),\n+        '/document_types'\n+      ];\n+      request(fetchApiUrl).get('/batch')\n+        .query({ pages: pages })\n+        .set('Authorization', 'Bearer ' + user.anyFetchToken)\n+        .expect(200)\n+        .end(rarity.carry([ pages ], cb));\n+    },\n+    function extractRes(pages, batchRes, cb) {\n+      var documents = batchRes.body[pages[0]].data;","path":"app/helpers/salesfetch.js","position":41,"original_position":41,"commit_id":"92fd7dadf1d7bbc47e21f0cf088ba0cf4247dc2b","original_commit_id":"92fd7dadf1d7bbc47e21f0cf088ba0cf4247dc2b","user":{"login":"Neamar","id":536844,"avatar_url":"https://avatars.githubusercontent.com/u/536844?","gravatar_id":"1bd44880100d5a4ce780441e4b54ddfe","url":"https://api.github.com/users/Neamar","html_url":"https://github.com/Neamar","followers_url":"https://api.github.com/users/Neamar/followers","following_url":"https://api.github.com/users/Neamar/following{/other_user}","gists_url":"https://api.github.com/users/Neamar/gists{/gist_id}","starred_url":"https://api.github.com/users/Neamar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Neamar/subscriptions","organizations_url":"https://api.github.com/users/Neamar/orgs","repos_url":"https://api.github.com/users/Neamar/repos","events_url":"https://api.github.com/users/Neamar/events{/privacy}","received_events_url":"https://api.github.com/users/Neamar/received_events","type":"User","site_admin":false},"body":"Smart one to pass the pages!\r\n\r\nHowever, maybe we can \"unstack\" the variable before passing thme to the waterfall, ta void using `pages` array in the next function","created_at":"2014-06-19T09:27:51Z","updated_at":"2014-06-19T09:27:51Z","html_url":"https://github.com/AnyFetch/salesFetch/pull/31#discussion_r13959508","pull_request_url":"https://api.github.com/repos/AnyFetch/salesFetch/pulls/31","_links":{"self":{"href":"https://api.github.com/repos/AnyFetch/salesFetch/pulls/comments/13959508"},"html":{"href":"https://github.com/AnyFetch/salesFetch/pull/31#discussion_r13959508"},"pull_request":{"href":"https://api.github.com/repos/AnyFetch/salesFetch/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/AnyFetch/salesFetch/pulls/31","id":17291474,"html_url":"https://github.com/AnyFetch/salesFetch/pull/31","diff_url":"https://github.com/AnyFetch/salesFetch/pull/31.diff","patch_url":"https://github.com/AnyFetch/salesFetch/pull/31.patch","issue_url":"https://api.github.com/repos/AnyFetch/salesFetch/issues/31","number":31,"state":"open","title":"Add and remove pins","user":{"login":"merlinND","id":5563370,"avatar_url":"https://avatars.githubusercontent.com/u/5563370?","gravatar_id":"e042c25d55f9ef560fc0c2de51188b2d","url":"https://api.github.com/users/merlinND","html_url":"https://github.com/merlinND","followers_url":"https://api.github.com/users/merlinND/followers","following_url":"https://api.github.com/users/merlinND/following{/other_user}","gists_url":"https://api.github.com/users/merlinND/gists{/gist_id}","starred_url":"https://api.github.com/users/merlinND/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/merlinND/subscriptions","organizations_url":"https://api.github.com/users/merlinND/orgs","repos_url":"https://api.github.com/users/merlinND/repos","events_url":"https://api.github.com/users/merlinND/events{/privacy}","received_events_url":"https://api.github.com/users/merlinND/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-06-18T12:58:20Z","updated_at":"2014-06-19T09:27:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"17b80cc1ed4235d21e4ffd28bf605ad0ee77cd60","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/AnyFetch/salesFetch/pulls/31/commits","review_comments_url":"https://api.github.com/repos/AnyFetch/salesFetch/pulls/31/comments","review_comment_url":"https://api.github.com/repos/AnyFetch/salesFetch/pulls/comments/{number}","comments_url":"https://api.github.com/repos/AnyFetch/salesFetch/issues/31/comments","statuses_url":"https://api.github.com/repos/AnyFetch/salesFetch/statuses/92fd7dadf1d7bbc47e21f0cf088ba0cf4247dc2b","head":{"label":"AnyFetch:add-pin","ref":"add-pin","sha":"92fd7dadf1d7bbc47e21f0cf088ba0cf4247dc2b","user":{"login":"AnyFetch","id":3952848,"avatar_url":"https://avatars.githubusercontent.com/u/3952848?","gravatar_id":"38a329820c5eab64decbf95bf7f3ebcb","url":"https://api.github.com/users/AnyFetch","html_url":"https://github.com/AnyFetch","followers_url":"https://api.github.com/users/AnyFetch/followers","following_url":"https://api.github.com/users/AnyFetch/following{/other_user}","gists_url":"https://api.github.com/users/AnyFetch/gists{/gist_id}","starred_url":"https://api.github.com/users/AnyFetch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnyFetch/subscriptions","organizations_url":"https://api.github.com/users/AnyFetch/orgs","repos_url":"https://api.github.com/users/AnyFetch/repos","events_url":"https://api.github.com/users/AnyFetch/events{/privacy}","received_events_url":"https://api.github.com/users/AnyFetch/received_events","type":"Organization","site_admin":false},"repo":{"id":16315043,"name":"salesFetch","full_name":"AnyFetch/salesFetch","owner":{"login":"AnyFetch","id":3952848,"avatar_url":"https://avatars.githubusercontent.com/u/3952848?","gravatar_id":"38a329820c5eab64decbf95bf7f3ebcb","url":"https://api.github.com/users/AnyFetch","html_url":"https://github.com/AnyFetch","followers_url":"https://api.github.com/users/AnyFetch/followers","following_url":"https://api.github.com/users/AnyFetch/following{/other_user}","gists_url":"https://api.github.com/users/AnyFetch/gists{/gist_id}","starred_url":"https://api.github.com/users/AnyFetch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnyFetch/subscriptions","organizations_url":"https://api.github.com/users/AnyFetch/orgs","repos_url":"https://api.github.com/users/AnyFetch/repos","events_url":"https://api.github.com/users/AnyFetch/events{/privacy}","received_events_url":"https://api.github.com/users/AnyFetch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AnyFetch/salesFetch","description":"FetchAPI integration in salesforce","fork":false,"url":"https://api.github.com/repos/AnyFetch/salesFetch","forks_url":"https://api.github.com/repos/AnyFetch/salesFetch/forks","keys_url":"https://api.github.com/repos/AnyFetch/salesFetch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AnyFetch/salesFetch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AnyFetch/salesFetch/teams","hooks_url":"https://api.github.com/repos/AnyFetch/salesFetch/hooks","issue_events_url":"https://api.github.com/repos/AnyFetch/salesFetch/issues/events{/number}","events_url":"https://api.github.com/repos/AnyFetch/salesFetch/events","assignees_url":"https://api.github.com/repos/AnyFetch/salesFetch/assignees{/user}","branches_url":"https://api.github.com/repos/AnyFetch/salesFetch/branches{/branch}","tags_url":"https://api.github.com/repos/AnyFetch/salesFetch/tags","blobs_url":"https://api.github.com/repos/AnyFetch/salesFetch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AnyFetch/salesFetch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AnyFetch/salesFetch/git/refs{/sha}","trees_url":"https://api.github.com/repos/AnyFetch/salesFetch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AnyFetch/salesFetch/statuses/{sha}","languages_url":"https://api.github.com/repos/AnyFetch/salesFetch/languages","stargazers_url":"https://api.github.com/repos/AnyFetch/salesFetch/stargazers","contributors_url":"https://api.github.com/repos/AnyFetch/salesFetch/contributors","subscribers_url":"https://api.github.com/repos/AnyFetch/salesFetch/subscribers","subscription_url":"https://api.github.com/repos/AnyFetch/salesFetch/subscription","commits_url":"https://api.github.com/repos/AnyFetch/salesFetch/commits{/sha}","git_commits_url":"https://api.github.com/repos/AnyFetch/salesFetch/git/commits{/sha}","comments_url":"https://api.github.com/repos/AnyFetch/salesFetch/comments{/number}","issue_comment_url":"https://api.github.com/repos/AnyFetch/salesFetch/issues/comments/{number}","contents_url":"https://api.github.com/repos/AnyFetch/salesFetch/contents/{+path}","compare_url":"https://api.github.com/repos/AnyFetch/salesFetch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AnyFetch/salesFetch/merges","archive_url":"https://api.github.com/repos/AnyFetch/salesFetch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AnyFetch/salesFetch/downloads","issues_url":"https://api.github.com/repos/AnyFetch/salesFetch/issues{/number}","pulls_url":"https://api.github.com/repos/AnyFetch/salesFetch/pulls{/number}","milestones_url":"https://api.github.com/repos/AnyFetch/salesFetch/milestones{/number}","notifications_url":"https://api.github.com/repos/AnyFetch/salesFetch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AnyFetch/salesFetch/labels{/name}","releases_url":"https://api.github.com/repos/AnyFetch/salesFetch/releases{/id}","created_at":"2014-01-28T15:05:04Z","updated_at":"2014-06-19T09:27:24Z","pushed_at":"2014-06-19T09:27:24Z","git_url":"git://github.com/AnyFetch/salesFetch.git","ssh_url":"git@github.com:AnyFetch/salesFetch.git","clone_url":"https://github.com/AnyFetch/salesFetch.git","svn_url":"https://github.com/AnyFetch/salesFetch","homepage":null,"size":2954,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"AnyFetch:pm-work","ref":"pm-work","sha":"cc7bc66ca86795bda74618327600120347119b62","user":{"login":"AnyFetch","id":3952848,"avatar_url":"https://avatars.githubusercontent.com/u/3952848?","gravatar_id":"38a329820c5eab64decbf95bf7f3ebcb","url":"https://api.github.com/users/AnyFetch","html_url":"https://github.com/AnyFetch","followers_url":"https://api.github.com/users/AnyFetch/followers","following_url":"https://api.github.com/users/AnyFetch/following{/other_user}","gists_url":"https://api.github.com/users/AnyFetch/gists{/gist_id}","starred_url":"https://api.github.com/users/AnyFetch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnyFetch/subscriptions","organizations_url":"https://api.github.com/users/AnyFetch/orgs","repos_url":"https://api.github.com/users/AnyFetch/repos","events_url":"https://api.github.com/users/AnyFetch/events{/privacy}","received_events_url":"https://api.github.com/users/AnyFetch/received_events","type":"Organization","site_admin":false},"repo":{"id":16315043,"name":"salesFetch","full_name":"AnyFetch/salesFetch","owner":{"login":"AnyFetch","id":3952848,"avatar_url":"https://avatars.githubusercontent.com/u/3952848?","gravatar_id":"38a329820c5eab64decbf95bf7f3ebcb","url":"https://api.github.com/users/AnyFetch","html_url":"https://github.com/AnyFetch","followers_url":"https://api.github.com/users/AnyFetch/followers","following_url":"https://api.github.com/users/AnyFetch/following{/other_user}","gists_url":"https://api.github.com/users/AnyFetch/gists{/gist_id}","starred_url":"https://api.github.com/users/AnyFetch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnyFetch/subscriptions","organizations_url":"https://api.github.com/users/AnyFetch/orgs","repos_url":"https://api.github.com/users/AnyFetch/repos","events_url":"https://api.github.com/users/AnyFetch/events{/privacy}","received_events_url":"https://api.github.com/users/AnyFetch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AnyFetch/salesFetch","description":"FetchAPI integration in salesforce","fork":false,"url":"https://api.github.com/repos/AnyFetch/salesFetch","forks_url":"https://api.github.com/repos/AnyFetch/salesFetch/forks","keys_url":"https://api.github.com/repos/AnyFetch/salesFetch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AnyFetch/salesFetch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AnyFetch/salesFetch/teams","hooks_url":"https://api.github.com/repos/AnyFetch/salesFetch/hooks","issue_events_url":"https://api.github.com/repos/AnyFetch/salesFetch/issues/events{/number}","events_url":"https://api.github.com/repos/AnyFetch/salesFetch/events","assignees_url":"https://api.github.com/repos/AnyFetch/salesFetch/assignees{/user}","branches_url":"https://api.github.com/repos/AnyFetch/salesFetch/branches{/branch}","tags_url":"https://api.github.com/repos/AnyFetch/salesFetch/tags","blobs_url":"https://api.github.com/repos/AnyFetch/salesFetch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AnyFetch/salesFetch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AnyFetch/salesFetch/git/refs{/sha}","trees_url":"https://api.github.com/repos/AnyFetch/salesFetch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AnyFetch/salesFetch/statuses/{sha}","languages_url":"https://api.github.com/repos/AnyFetch/salesFetch/languages","stargazers_url":"https://api.github.com/repos/AnyFetch/salesFetch/stargazers","contributors_url":"https://api.github.com/repos/AnyFetch/salesFetch/contributors","subscribers_url":"https://api.github.com/repos/AnyFetch/salesFetch/subscribers","subscription_url":"https://api.github.com/repos/AnyFetch/salesFetch/subscription","commits_url":"https://api.github.com/repos/AnyFetch/salesFetch/commits{/sha}","git_commits_url":"https://api.github.com/repos/AnyFetch/salesFetch/git/commits{/sha}","comments_url":"https://api.github.com/repos/AnyFetch/salesFetch/comments{/number}","issue_comment_url":"https://api.github.com/repos/AnyFetch/salesFetch/issues/comments/{number}","contents_url":"https://api.github.com/repos/AnyFetch/salesFetch/contents/{+path}","compare_url":"https://api.github.com/repos/AnyFetch/salesFetch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AnyFetch/salesFetch/merges","archive_url":"https://api.github.com/repos/AnyFetch/salesFetch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AnyFetch/salesFetch/downloads","issues_url":"https://api.github.com/repos/AnyFetch/salesFetch/issues{/number}","pulls_url":"https://api.github.com/repos/AnyFetch/salesFetch/pulls{/number}","milestones_url":"https://api.github.com/repos/AnyFetch/salesFetch/milestones{/number}","notifications_url":"https://api.github.com/repos/AnyFetch/salesFetch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AnyFetch/salesFetch/labels{/name}","releases_url":"https://api.github.com/repos/AnyFetch/salesFetch/releases{/id}","created_at":"2014-01-28T15:05:04Z","updated_at":"2014-06-19T09:27:24Z","pushed_at":"2014-06-19T09:27:24Z","git_url":"git://github.com/AnyFetch/salesFetch.git","ssh_url":"git@github.com:AnyFetch/salesFetch.git","clone_url":"https://github.com/AnyFetch/salesFetch.git","svn_url":"https://github.com/AnyFetch/salesFetch","homepage":null,"size":2954,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AnyFetch/salesFetch/pulls/31"},"html":{"href":"https://github.com/AnyFetch/salesFetch/pull/31"},"issue":{"href":"https://api.github.com/repos/AnyFetch/salesFetch/issues/31"},"comments":{"href":"https://api.github.com/repos/AnyFetch/salesFetch/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/AnyFetch/salesFetch/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/AnyFetch/salesFetch/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/AnyFetch/salesFetch/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/AnyFetch/salesFetch/statuses/92fd7dadf1d7bbc47e21f0cf088ba0cf4247dc2b"}}}}