{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/87208488","pull_request_review_id":7828843,"id":87208488,"diff_hunk":"@@ -1,36 +1,32 @@\n /**\n  * External Dependencies\n  */\n-import { assign, find, startsWith } from 'lodash';\n+import { assign, find } from 'lodash';\n \n /**\n  * Internal Dependencies\n  */\n-import { imageSizeFromAttachments, thumbIsLikelyImage } from './utils';\n+import { imageSizeFromAttachments, thumbIsLikelyImage, isCandidateForCanonicalImage } from './utils';\n \n export default function firstPassCanonicalImage( post ) {\n \tif ( thumbIsLikelyImage( post.post_thumbnail ) ) {\n \t\tconst { URL: url, width, height } = post.post_thumbnail;\n \t\tpost.canonical_image = {\n \t\t\turi: url,\n \t\t\twidth,\n-\t\t\theight,\n-\t\t\ttype: 'image'\n+\t\t\theight\n \t\t};\n \t} else if ( post.featured_image ) {\n \t\tpost.canonical_image = assign( {\n-\t\t\turi: post.featured_image,\n-\t\t\ttype: 'image'\n+\t\t\turi: post.featured_image\n \t\t}, imageSizeFromAttachments( post.featured_image ) );\n-\t} else {\n-\t\tconst candidate = find( post.attachments, ( { mime_type } ) => startsWith( mime_type, 'image/' ) );\n-\n-\t\tif ( candidate ) {\n-\t\t\tpost.canonical_image = {\n-\t\t\t\turi: candidate.URL,\n-\t\t\t\twidth: candidate.width,\n-\t\t\t\theight: candidate.height,\n-\t\t\t\ttype: 'image'\n+\t} else if ( post.content_images && post.content_images.length ) {\n+\t\tconst canonicalImage = find( post.content_images, isCandidateForCanonicalImage );\n+\t\tif ( canonicalImage ) {\n+\t\t\tpost.canonicalImage = {","path":"client/lib/post-normalizer/rule-first-pass-canonical-image.js","position":41,"original_position":41,"commit_id":"e5287bf77e55a6067799a14f2e30001aed43daa9","original_commit_id":"e5287bf77e55a6067799a14f2e30001aed43daa9","user":{"login":"blowery","id":14350,"avatar_url":"https://avatars.githubusercontent.com/u/14350?v=3","gravatar_id":"","url":"https://api.github.com/users/blowery","html_url":"https://github.com/blowery","followers_url":"https://api.github.com/users/blowery/followers","following_url":"https://api.github.com/users/blowery/following{/other_user}","gists_url":"https://api.github.com/users/blowery/gists{/gist_id}","starred_url":"https://api.github.com/users/blowery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blowery/subscriptions","organizations_url":"https://api.github.com/users/blowery/orgs","repos_url":"https://api.github.com/users/blowery/repos","events_url":"https://api.github.com/users/blowery/events{/privacy}","received_events_url":"https://api.github.com/users/blowery/received_events","type":"User","site_admin":false},"body":"nope, good catch","created_at":"2016-11-09T15:03:56Z","updated_at":"2016-11-09T15:03:56Z","html_url":"https://github.com/Automattic/wp-calypso/pull/9238#discussion_r87208488","pull_request_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/9238","_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/87208488"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/9238#discussion_r87208488"},"pull_request":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/9238"}}},"pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/9238","id":92883873,"html_url":"https://github.com/Automattic/wp-calypso/pull/9238","diff_url":"https://github.com/Automattic/wp-calypso/pull/9238.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/9238.patch","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/9238","number":9238,"state":"open","locked":false,"title":"PostNorm: Eagerly grab and use the width and height for images","user":{"login":"blowery","id":14350,"avatar_url":"https://avatars.githubusercontent.com/u/14350?v=3","gravatar_id":"","url":"https://api.github.com/users/blowery","html_url":"https://github.com/blowery","followers_url":"https://api.github.com/users/blowery/followers","following_url":"https://api.github.com/users/blowery/following{/other_user}","gists_url":"https://api.github.com/users/blowery/gists{/gist_id}","starred_url":"https://api.github.com/users/blowery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blowery/subscriptions","organizations_url":"https://api.github.com/users/blowery/orgs","repos_url":"https://api.github.com/users/blowery/repos","events_url":"https://api.github.com/users/blowery/events{/privacy}","received_events_url":"https://api.github.com/users/blowery/received_events","type":"User","site_admin":false},"body":"Previously, we used the naturalHeight and naturalWidth to capture and communicate the dimensions of a loaded image.\r\n\r\nThis changes things to normalize onto the normal width and height attributes, and teaches some of the rules downstream from wait-for-content-images-to-load how to use these new attributes.\r\n\r\nThis allows the reader to pick a canonical image much earlier in the process and for that canonical image to be stable in many more cases.","created_at":"2016-11-08T23:57:58Z","updated_at":"2016-11-09T15:03:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"755f39e99ee75aeafcd20041d44af3e5ff34d8e0","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/Automattic/wp-calypso/milestones/126","html_url":"https://github.com/Automattic/wp-calypso/milestones/Reader%20Stream%20Refresh:%20Cards","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones/126/labels","id":1993599,"number":126,"title":"Reader Stream Refresh: Cards","description":"Updating all the cards to the new styles.","creator":{"login":"blowery","id":14350,"avatar_url":"https://avatars.githubusercontent.com/u/14350?v=3","gravatar_id":"","url":"https://api.github.com/users/blowery","html_url":"https://github.com/blowery","followers_url":"https://api.github.com/users/blowery/followers","following_url":"https://api.github.com/users/blowery/following{/other_user}","gists_url":"https://api.github.com/users/blowery/gists{/gist_id}","starred_url":"https://api.github.com/users/blowery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blowery/subscriptions","organizations_url":"https://api.github.com/users/blowery/orgs","repos_url":"https://api.github.com/users/blowery/repos","events_url":"https://api.github.com/users/blowery/events{/privacy}","received_events_url":"https://api.github.com/users/blowery/received_events","type":"User","site_admin":false},"open_issues":25,"closed_issues":101,"state":"open","created_at":"2016-09-09T14:26:29Z","updated_at":"2016-11-09T03:58:07Z","due_on":"2016-11-11T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/9238/commits","review_comments_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/9238/comments","review_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/9238/comments","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/e5287bf77e55a6067799a14f2e30001aed43daa9","head":{"label":"Automattic:update/reader/eager-image-dimensions","ref":"update/reader/eager-image-dimensions","sha":"e5287bf77e55a6067799a14f2e30001aed43daa9","user":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"repo":{"id":45936895,"name":"wp-calypso","full_name":"Automattic/wp-calypso","owner":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Automattic/wp-calypso","description":"The new JavaScript- and API-powered WordPress.com","fork":false,"url":"https://api.github.com/repos/Automattic/wp-calypso","forks_url":"https://api.github.com/repos/Automattic/wp-calypso/forks","keys_url":"https://api.github.com/repos/Automattic/wp-calypso/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/wp-calypso/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/wp-calypso/teams","hooks_url":"https://api.github.com/repos/Automattic/wp-calypso/hooks","issue_events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/wp-calypso/events","assignees_url":"https://api.github.com/repos/Automattic/wp-calypso/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/wp-calypso/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/wp-calypso/tags","blobs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/wp-calypso/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/wp-calypso/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/wp-calypso/languages","stargazers_url":"https://api.github.com/repos/Automattic/wp-calypso/stargazers","contributors_url":"https://api.github.com/repos/Automattic/wp-calypso/contributors","subscribers_url":"https://api.github.com/repos/Automattic/wp-calypso/subscribers","subscription_url":"https://api.github.com/repos/Automattic/wp-calypso/subscription","commits_url":"https://api.github.com/repos/Automattic/wp-calypso/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/wp-calypso/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/wp-calypso/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/wp-calypso/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/wp-calypso/merges","archive_url":"https://api.github.com/repos/Automattic/wp-calypso/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/wp-calypso/downloads","issues_url":"https://api.github.com/repos/Automattic/wp-calypso/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/wp-calypso/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/wp-calypso/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/wp-calypso/deployments","created_at":"2015-11-10T20:00:16Z","updated_at":"2016-11-09T12:39:03Z","pushed_at":"2016-11-09T15:03:43Z","git_url":"git://github.com/Automattic/wp-calypso.git","ssh_url":"git@github.com:Automattic/wp-calypso.git","clone_url":"https://github.com/Automattic/wp-calypso.git","svn_url":"https://github.com/Automattic/wp-calypso","homepage":"https://developer.wordpress.com/calypso/","size":151223,"stargazers_count":8040,"watchers_count":8040,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1008,"mirror_url":null,"open_issues_count":1507,"forks":1008,"open_issues":1507,"watchers":8040,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"96e8debd6fec4551129ce1f43a913dd1fd7be79f","user":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"repo":{"id":45936895,"name":"wp-calypso","full_name":"Automattic/wp-calypso","owner":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Automattic/wp-calypso","description":"The new JavaScript- and API-powered WordPress.com","fork":false,"url":"https://api.github.com/repos/Automattic/wp-calypso","forks_url":"https://api.github.com/repos/Automattic/wp-calypso/forks","keys_url":"https://api.github.com/repos/Automattic/wp-calypso/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/wp-calypso/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/wp-calypso/teams","hooks_url":"https://api.github.com/repos/Automattic/wp-calypso/hooks","issue_events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/wp-calypso/events","assignees_url":"https://api.github.com/repos/Automattic/wp-calypso/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/wp-calypso/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/wp-calypso/tags","blobs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/wp-calypso/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/wp-calypso/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/wp-calypso/languages","stargazers_url":"https://api.github.com/repos/Automattic/wp-calypso/stargazers","contributors_url":"https://api.github.com/repos/Automattic/wp-calypso/contributors","subscribers_url":"https://api.github.com/repos/Automattic/wp-calypso/subscribers","subscription_url":"https://api.github.com/repos/Automattic/wp-calypso/subscription","commits_url":"https://api.github.com/repos/Automattic/wp-calypso/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/wp-calypso/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/wp-calypso/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/wp-calypso/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/wp-calypso/merges","archive_url":"https://api.github.com/repos/Automattic/wp-calypso/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/wp-calypso/downloads","issues_url":"https://api.github.com/repos/Automattic/wp-calypso/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/wp-calypso/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/wp-calypso/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/wp-calypso/deployments","created_at":"2015-11-10T20:00:16Z","updated_at":"2016-11-09T12:39:03Z","pushed_at":"2016-11-09T15:03:43Z","git_url":"git://github.com/Automattic/wp-calypso.git","ssh_url":"git@github.com:Automattic/wp-calypso.git","clone_url":"https://github.com/Automattic/wp-calypso.git","svn_url":"https://github.com/Automattic/wp-calypso","homepage":"https://developer.wordpress.com/calypso/","size":151223,"stargazers_count":8040,"watchers_count":8040,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1008,"mirror_url":null,"open_issues_count":1507,"forks":1008,"open_issues":1507,"watchers":8040,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/9238"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/9238"},"issue":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/9238"},"comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/9238/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/9238/comments"},"review_comment":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/9238/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/wp-calypso/statuses/e5287bf77e55a6067799a14f2e30001aed43daa9"}}}}
{"actor":{"display_login":"blowery"}}