{"action":"created","comment":{"url":"https://api.github.com/repos/Financial-Times/next-grumman/pulls/comments/26478036","id":26478036,"diff_hunk":"@@ -1,42 +1,59 @@\n 'use strict';\n \n var ft = require('../utils/api').ft;\n-var Stream = require('../models/stream');\n+var fetchCapiV1 = require('../utils/fetch-capi-v1');\n+var fetchCapiV2 = require('../utils/fetch-capi-v2');\n var cacheControl = require('../utils/cache-control');\n+var fetchres = require('fetchres');\n \n module.exports = function(req, res, next) {\n-\tft\n-\t\t.get([req.params.id])\n+\tfetchCapiV1({ uuid: req.params.id })\n \t\t.then(function(article) {\n-\t\t\tif (article[0] && article[0].packages && article[0].packages.length > 0) {\n-\t\t\t\tarticle = article[0];\n-\t\t\t} else {\n+\t\t\tres.set(cacheControl);\n+\t\t\tif (!article || !article.item || !article.item.package || article.item.package.length === 0) {\n \t\t\t\tres.status(404).send();\n \t\t\t\treturn;\n \t\t\t}\n+\t\t\tvar moreOns = article.item.package;\n \n-\t\t\treturn ft\n-\t\t\t\t.get(article.packages)\n-\t\t\t\t.then(function(articles) {\n-\t\t\t\t\tif (articles.length > 0) {\n-\t\t\t\t\t\tvar stream = new Stream();\n-\t\t\t\t\t\tarticles\n-\t\t\t\t\t\t\t// some articles may be undefined\n-\t\t\t\t\t\t\t.filter(function (a) { return !!a; })\n-\t\t\t\t\t\t\t.slice(0, req.query.count || undefined)\n-\t\t\t\t\t\t\t.forEach(function(item) {\n-\t\t\t\t\t\t\t\tstream.push('methode', item);\n-\t\t\t\t\t\t\t});\n-\t\t\t\t\t\tres.set(cacheControl);\n-\t\t\t\t\t\tres.render('more-on' + (req.query.view ? '-' + req.query.view : ''), {\n-\t\t\t\t\t\t\tmode: 'expand',\n-\t\t\t\t\t\t\tstream: stream.texturedItems,\n-\t\t\t\t\t\t\ttitle: 'See also'\n+\t\t\treturn Promise.all(moreOns.map(function(moreOn) {\n+\t\t\t\t\treturn fetchCapiV2({ uuid: moreOn.id })","path":"server/controllers/more-on.js","position":43,"original_position":43,"commit_id":"a82dfc88c08ba2807196dad50a8a58d18de50211","original_commit_id":"a82dfc88c08ba2807196dad50a8a58d18de50211","user":{"login":"matthew-andrews","id":825088,"avatar_url":"https://avatars.githubusercontent.com/u/825088?v=3","gravatar_id":"","url":"https://api.github.com/users/matthew-andrews","html_url":"https://github.com/matthew-andrews","followers_url":"https://api.github.com/users/matthew-andrews/followers","following_url":"https://api.github.com/users/matthew-andrews/following{/other_user}","gists_url":"https://api.github.com/users/matthew-andrews/gists{/gist_id}","starred_url":"https://api.github.com/users/matthew-andrews/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthew-andrews/subscriptions","organizations_url":"https://api.github.com/users/matthew-andrews/orgs","repos_url":"https://api.github.com/users/matthew-andrews/repos","events_url":"https://api.github.com/users/matthew-andrews/events{/privacy}","received_events_url":"https://api.github.com/users/matthew-andrews/received_events","type":"User","site_admin":false},"body":"using capi v2 helps us promote fewer articles that won't work on Next ","created_at":"2015-03-16T11:53:22Z","updated_at":"2015-03-16T11:53:22Z","html_url":"https://github.com/Financial-Times/next-grumman/pull/240#discussion_r26478036","pull_request_url":"https://api.github.com/repos/Financial-Times/next-grumman/pulls/240","_links":{"self":{"href":"https://api.github.com/repos/Financial-Times/next-grumman/pulls/comments/26478036"},"html":{"href":"https://github.com/Financial-Times/next-grumman/pull/240#discussion_r26478036"},"pull_request":{"href":"https://api.github.com/repos/Financial-Times/next-grumman/pulls/240"}}},"pull_request":{"url":"https://api.github.com/repos/Financial-Times/next-grumman/pulls/240","id":31236531,"html_url":"https://github.com/Financial-Times/next-grumman/pull/240","diff_url":"https://github.com/Financial-Times/next-grumman/pull/240.diff","patch_url":"https://github.com/Financial-Times/next-grumman/pull/240.patch","issue_url":"https://api.github.com/repos/Financial-Times/next-grumman/issues/240","number":240,"state":"open","locked":false,"title":"Starting to work on improved related content","user":{"login":"matthew-andrews","id":825088,"avatar_url":"https://avatars.githubusercontent.com/u/825088?v=3","gravatar_id":"","url":"https://api.github.com/users/matthew-andrews","html_url":"https://github.com/matthew-andrews","followers_url":"https://api.github.com/users/matthew-andrews/followers","following_url":"https://api.github.com/users/matthew-andrews/following{/other_user}","gists_url":"https://api.github.com/users/matthew-andrews/gists{/gist_id}","starred_url":"https://api.github.com/users/matthew-andrews/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthew-andrews/subscriptions","organizations_url":"https://api.github.com/users/matthew-andrews/orgs","repos_url":"https://api.github.com/users/matthew-andrews/repos","events_url":"https://api.github.com/users/matthew-andrews/events{/privacy}","received_events_url":"https://api.github.com/users/matthew-andrews/received_events","type":"User","site_admin":false},"body":"not for merging yet but just wanted to give a quick preview of the direction i'm thinking about going @ironsidevsquincy ","created_at":"2015-03-16T11:52:00Z","updated_at":"2015-03-16T11:53:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"21ceeccb30523cf7d3b8b71c081c05fc3690c745","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Financial-Times/next-grumman/pulls/240/commits","review_comments_url":"https://api.github.com/repos/Financial-Times/next-grumman/pulls/240/comments","review_comment_url":"https://api.github.com/repos/Financial-Times/next-grumman/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Financial-Times/next-grumman/issues/240/comments","statuses_url":"https://api.github.com/repos/Financial-Times/next-grumman/statuses/a82dfc88c08ba2807196dad50a8a58d18de50211","head":{"label":"Financial-Times:more-on-v2","ref":"more-on-v2","sha":"a82dfc88c08ba2807196dad50a8a58d18de50211","user":{"login":"Financial-Times","id":3502508,"avatar_url":"https://avatars.githubusercontent.com/u/3502508?v=3","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"repo":{"id":26121818,"name":"next-grumman","full_name":"Financial-Times/next-grumman","owner":{"login":"Financial-Times","id":3502508,"avatar_url":"https://avatars.githubusercontent.com/u/3502508?v=3","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Financial-Times/next-grumman","description":"For articles","fork":false,"url":"https://api.github.com/repos/Financial-Times/next-grumman","forks_url":"https://api.github.com/repos/Financial-Times/next-grumman/forks","keys_url":"https://api.github.com/repos/Financial-Times/next-grumman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Financial-Times/next-grumman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Financial-Times/next-grumman/teams","hooks_url":"https://api.github.com/repos/Financial-Times/next-grumman/hooks","issue_events_url":"https://api.github.com/repos/Financial-Times/next-grumman/issues/events{/number}","events_url":"https://api.github.com/repos/Financial-Times/next-grumman/events","assignees_url":"https://api.github.com/repos/Financial-Times/next-grumman/assignees{/user}","branches_url":"https://api.github.com/repos/Financial-Times/next-grumman/branches{/branch}","tags_url":"https://api.github.com/repos/Financial-Times/next-grumman/tags","blobs_url":"https://api.github.com/repos/Financial-Times/next-grumman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Financial-Times/next-grumman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Financial-Times/next-grumman/git/refs{/sha}","trees_url":"https://api.github.com/repos/Financial-Times/next-grumman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Financial-Times/next-grumman/statuses/{sha}","languages_url":"https://api.github.com/repos/Financial-Times/next-grumman/languages","stargazers_url":"https://api.github.com/repos/Financial-Times/next-grumman/stargazers","contributors_url":"https://api.github.com/repos/Financial-Times/next-grumman/contributors","subscribers_url":"https://api.github.com/repos/Financial-Times/next-grumman/subscribers","subscription_url":"https://api.github.com/repos/Financial-Times/next-grumman/subscription","commits_url":"https://api.github.com/repos/Financial-Times/next-grumman/commits{/sha}","git_commits_url":"https://api.github.com/repos/Financial-Times/next-grumman/git/commits{/sha}","comments_url":"https://api.github.com/repos/Financial-Times/next-grumman/comments{/number}","issue_comment_url":"https://api.github.com/repos/Financial-Times/next-grumman/issues/comments{/number}","contents_url":"https://api.github.com/repos/Financial-Times/next-grumman/contents/{+path}","compare_url":"https://api.github.com/repos/Financial-Times/next-grumman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Financial-Times/next-grumman/merges","archive_url":"https://api.github.com/repos/Financial-Times/next-grumman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Financial-Times/next-grumman/downloads","issues_url":"https://api.github.com/repos/Financial-Times/next-grumman/issues{/number}","pulls_url":"https://api.github.com/repos/Financial-Times/next-grumman/pulls{/number}","milestones_url":"https://api.github.com/repos/Financial-Times/next-grumman/milestones{/number}","notifications_url":"https://api.github.com/repos/Financial-Times/next-grumman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Financial-Times/next-grumman/labels{/name}","releases_url":"https://api.github.com/repos/Financial-Times/next-grumman/releases{/id}","created_at":"2014-11-03T14:22:04Z","updated_at":"2015-03-16T11:42:37Z","pushed_at":"2015-03-16T11:51:22Z","git_url":"git://github.com/Financial-Times/next-grumman.git","ssh_url":"git@github.com:Financial-Times/next-grumman.git","clone_url":"https://github.com/Financial-Times/next-grumman.git","svn_url":"https://github.com/Financial-Times/next-grumman","homepage":null,"size":8981,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"Financial-Times:master","ref":"master","sha":"78ed58f8fd0c30fcf2fa01f4fe5c1ed12551f0d7","user":{"login":"Financial-Times","id":3502508,"avatar_url":"https://avatars.githubusercontent.com/u/3502508?v=3","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"repo":{"id":26121818,"name":"next-grumman","full_name":"Financial-Times/next-grumman","owner":{"login":"Financial-Times","id":3502508,"avatar_url":"https://avatars.githubusercontent.com/u/3502508?v=3","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Financial-Times/next-grumman","description":"For articles","fork":false,"url":"https://api.github.com/repos/Financial-Times/next-grumman","forks_url":"https://api.github.com/repos/Financial-Times/next-grumman/forks","keys_url":"https://api.github.com/repos/Financial-Times/next-grumman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Financial-Times/next-grumman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Financial-Times/next-grumman/teams","hooks_url":"https://api.github.com/repos/Financial-Times/next-grumman/hooks","issue_events_url":"https://api.github.com/repos/Financial-Times/next-grumman/issues/events{/number}","events_url":"https://api.github.com/repos/Financial-Times/next-grumman/events","assignees_url":"https://api.github.com/repos/Financial-Times/next-grumman/assignees{/user}","branches_url":"https://api.github.com/repos/Financial-Times/next-grumman/branches{/branch}","tags_url":"https://api.github.com/repos/Financial-Times/next-grumman/tags","blobs_url":"https://api.github.com/repos/Financial-Times/next-grumman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Financial-Times/next-grumman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Financial-Times/next-grumman/git/refs{/sha}","trees_url":"https://api.github.com/repos/Financial-Times/next-grumman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Financial-Times/next-grumman/statuses/{sha}","languages_url":"https://api.github.com/repos/Financial-Times/next-grumman/languages","stargazers_url":"https://api.github.com/repos/Financial-Times/next-grumman/stargazers","contributors_url":"https://api.github.com/repos/Financial-Times/next-grumman/contributors","subscribers_url":"https://api.github.com/repos/Financial-Times/next-grumman/subscribers","subscription_url":"https://api.github.com/repos/Financial-Times/next-grumman/subscription","commits_url":"https://api.github.com/repos/Financial-Times/next-grumman/commits{/sha}","git_commits_url":"https://api.github.com/repos/Financial-Times/next-grumman/git/commits{/sha}","comments_url":"https://api.github.com/repos/Financial-Times/next-grumman/comments{/number}","issue_comment_url":"https://api.github.com/repos/Financial-Times/next-grumman/issues/comments{/number}","contents_url":"https://api.github.com/repos/Financial-Times/next-grumman/contents/{+path}","compare_url":"https://api.github.com/repos/Financial-Times/next-grumman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Financial-Times/next-grumman/merges","archive_url":"https://api.github.com/repos/Financial-Times/next-grumman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Financial-Times/next-grumman/downloads","issues_url":"https://api.github.com/repos/Financial-Times/next-grumman/issues{/number}","pulls_url":"https://api.github.com/repos/Financial-Times/next-grumman/pulls{/number}","milestones_url":"https://api.github.com/repos/Financial-Times/next-grumman/milestones{/number}","notifications_url":"https://api.github.com/repos/Financial-Times/next-grumman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Financial-Times/next-grumman/labels{/name}","releases_url":"https://api.github.com/repos/Financial-Times/next-grumman/releases{/id}","created_at":"2014-11-03T14:22:04Z","updated_at":"2015-03-16T11:42:37Z","pushed_at":"2015-03-16T11:51:22Z","git_url":"git://github.com/Financial-Times/next-grumman.git","ssh_url":"git@github.com:Financial-Times/next-grumman.git","clone_url":"https://github.com/Financial-Times/next-grumman.git","svn_url":"https://github.com/Financial-Times/next-grumman","homepage":null,"size":8981,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Financial-Times/next-grumman/pulls/240"},"html":{"href":"https://github.com/Financial-Times/next-grumman/pull/240"},"issue":{"href":"https://api.github.com/repos/Financial-Times/next-grumman/issues/240"},"comments":{"href":"https://api.github.com/repos/Financial-Times/next-grumman/issues/240/comments"},"review_comments":{"href":"https://api.github.com/repos/Financial-Times/next-grumman/pulls/240/comments"},"review_comment":{"href":"https://api.github.com/repos/Financial-Times/next-grumman/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Financial-Times/next-grumman/pulls/240/commits"},"statuses":{"href":"https://api.github.com/repos/Financial-Times/next-grumman/statuses/a82dfc88c08ba2807196dad50a8a58d18de50211"}}}}