{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/74153275","id":74153275,"diff_hunk":"@@ -24,27 +27,67 @@ import {\n \tgetSelectedSite\n } from 'state/ui/selectors';\n \n-const largeBlavatar = site => `${ get( site, 'icon.img', '//gravatar.com/avatar/' ) }?s=512`;\n+const PREVIEW_IMAGE_WIDTH = 512;\n+const largeBlavatar = site => `${ get( site, 'icon.img', '//gravatar.com/avatar/' ) }?s=${ PREVIEW_IMAGE_WIDTH }`;\n+\n+const getPostImage = ( post ) => {\n+\tif ( ! post ) {\n+\t\treturn null;\n+\t}\n+\n+\t// Use the featured image if one was set\n+\tif ( post.featured_image ) {\n+\t\treturn post.featured_image;\n+\t}\n+\n+\t// Otherwise we'll look for a large enough image in the post\n+\tconst content = post.content;\n+\tif ( ! content ) {\n+\t\treturn null;\n+\t}\n+\n+\tconst imgElements = parseHtml( content ).querySelectorAll( 'img' );\n+\tconst largeImage = get( find( imgElements, ( { width } ) => width >= PREVIEW_IMAGE_WIDTH ), 'src', null );","path":"client/components/seo-preview-pane/index.jsx","position":45,"original_position":45,"commit_id":"c8e8f5e08b2c9861193ba6aefbcc1243ee0e7203","original_commit_id":"c8e8f5e08b2c9861193ba6aefbcc1243ee0e7203","user":{"login":"dmsnell","id":5431237,"avatar_url":"https://avatars.githubusercontent.com/u/5431237?v=3","gravatar_id":"","url":"https://api.github.com/users/dmsnell","html_url":"https://github.com/dmsnell","followers_url":"https://api.github.com/users/dmsnell/followers","following_url":"https://api.github.com/users/dmsnell/following{/other_user}","gists_url":"https://api.github.com/users/dmsnell/gists{/gist_id}","starred_url":"https://api.github.com/users/dmsnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmsnell/subscriptions","organizations_url":"https://api.github.com/users/dmsnell/orgs","repos_url":"https://api.github.com/users/dmsnell/repos","events_url":"https://api.github.com/users/dmsnell/events{/privacy}","received_events_url":"https://api.github.com/users/dmsnell/received_events","type":"User","site_admin":false},"body":"haha, `=> width >=` - what visual beauty!","created_at":"2016-08-09T22:02:35Z","updated_at":"2016-08-09T22:02:35Z","html_url":"https://github.com/Automattic/wp-calypso/pull/7338#discussion_r74153275","pull_request_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/7338","_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/74153275"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/7338#discussion_r74153275"},"pull_request":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/7338"}}},"pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/7338","id":80506202,"html_url":"https://github.com/Automattic/wp-calypso/pull/7338","diff_url":"https://github.com/Automattic/wp-calypso/pull/7338.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/7338.patch","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/7338","number":7338,"state":"open","locked":false,"title":"Advanced SEO: Add Reader Preview","user":{"login":"roundhill","id":789137,"avatar_url":"https://avatars.githubusercontent.com/u/789137?v=3","gravatar_id":"","url":"https://api.github.com/users/roundhill","html_url":"https://github.com/roundhill","followers_url":"https://api.github.com/users/roundhill/followers","following_url":"https://api.github.com/users/roundhill/following{/other_user}","gists_url":"https://api.github.com/users/roundhill/gists{/gist_id}","starred_url":"https://api.github.com/users/roundhill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roundhill/subscriptions","organizations_url":"https://api.github.com/users/roundhill/orgs","repos_url":"https://api.github.com/users/roundhill/repos","events_url":"https://api.github.com/users/roundhill/events{/privacy}","received_events_url":"https://api.github.com/users/roundhill/received_events","type":"User","site_admin":false},"body":"Adds a basic Reader Preview to the Advanced SEO Social Preview area of the editor preview. It won't be a 100% accurate representation of what a user will see in the Reader, but it's a good start :)\r\n\r\nIt was decided for this iteration to use the same classNames and styles from the `reader/stream/post` component. In the near future we can switch this component to use a new Reader post card that is currently in development by the Reader squad.\r\n\r\nIt uses a few utilities that the Reader offers, which means I need to add the server side rendering flag to a few of the files. I also split out a `formatExcerpt` method in `lib/post-normalizer/rule-create-better-excerpt.js` so that we can get a nicely formatted post excerpt from the content.\r\n\r\n**To Test**\r\n* Ensure your site has a business plan.\r\n* Create/edit a post and preview it in the Social sharing tab. You should see the Reader preview there.\r\n* It should pick up an image to preview if it is large enough.\r\n* Try it in multiple screen sizes!\r\n\r\n<img width=\"931\" alt=\"screen shot 2016-08-08 at 12 08 59 pm\" src=\"https://cloud.githubusercontent.com/assets/789137/17492528/0263044a-5d61-11e6-8904-125a090352dd.png\">\r\n\r\n\r\nTest live: https://calypso.live/?branch=add/advanced-seo-reader-preview","created_at":"2016-08-08T19:20:38Z","updated_at":"2016-08-09T22:02:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb817035af840ec8f5174d4b668f3d0c55c89364","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/Automattic/wp-calypso/milestones/96","html_url":"https://github.com/Automattic/wp-calypso/milestones/Advanced%20SEO","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones/96/labels","id":1802510,"number":96,"title":"Advanced SEO","description":"Advanced SEO settings for the business plan.","creator":{"login":"roundhill","id":789137,"avatar_url":"https://avatars.githubusercontent.com/u/789137?v=3","gravatar_id":"","url":"https://api.github.com/users/roundhill","html_url":"https://github.com/roundhill","followers_url":"https://api.github.com/users/roundhill/followers","following_url":"https://api.github.com/users/roundhill/following{/other_user}","gists_url":"https://api.github.com/users/roundhill/gists{/gist_id}","starred_url":"https://api.github.com/users/roundhill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roundhill/subscriptions","organizations_url":"https://api.github.com/users/roundhill/orgs","repos_url":"https://api.github.com/users/roundhill/repos","events_url":"https://api.github.com/users/roundhill/events{/privacy}","received_events_url":"https://api.github.com/users/roundhill/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":34,"state":"open","created_at":"2016-06-01T14:38:15Z","updated_at":"2016-08-08T22:36:47Z","due_on":"2016-08-01T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/7338/commits","review_comments_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/7338/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/7338/comments","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/c8e8f5e08b2c9861193ba6aefbcc1243ee0e7203","head":{"label":"Automattic:add/advanced-seo-reader-preview","ref":"add/advanced-seo-reader-preview","sha":"c8e8f5e08b2c9861193ba6aefbcc1243ee0e7203","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-08-09T20:12:21Z","pushed_at":"2016-08-09T21:58:55Z","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":84242,"stargazers_count":7678,"watchers_count":7678,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":964,"mirror_url":null,"open_issues_count":1442,"forks":964,"open_issues":1442,"watchers":7678,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"f2194b6dd24929e1e5be0ee69e0c800612cafd06","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-08-09T20:12:21Z","pushed_at":"2016-08-09T21:58:55Z","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":84242,"stargazers_count":7678,"watchers_count":7678,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":964,"mirror_url":null,"open_issues_count":1442,"forks":964,"open_issues":1442,"watchers":7678,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/7338"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/7338"},"issue":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/7338"},"comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/7338/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/7338/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/7338/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/wp-calypso/statuses/c8e8f5e08b2c9861193ba6aefbcc1243ee0e7203"}}}}
{"actor":{"display_login":"dmsnell"}}