{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/liveblog/pulls/comments/209451163","pull_request_review_id":145470611,"id":209451163,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTQ1MTE2Mw==","diff_hunk":"@@ -188,50 +188,41 @@ public static function append_liveblog_to_metadata( $metadata, $post ) {\n \n \t\t$request = self::get_request_data();\n \n-\t\t$publisher_organization = '';\n-\t\t$publisher_name         = '';\n-\n \t\t$entries = WPCOM_Liveblog::get_entries_paged( $request->page, $request->last );\n \n \t\t$blog_updates = [];\n \n-\t\tif ( isset( $entries['entries'] ) && is_array( $entries['entries'] ) ) {\n-\t\t\tforeach ( $entries['entries'] as $key => $entry ) {\n-\n-\t\t\t\tif ( isset( $metadata['publisher']['name'] ) ) {\n-\t\t\t\t\t$publisher_name = $metadata['publisher']['name'];\n-\t\t\t\t}\n-\n-\t\t\t\tif ( isset( $metadata['publisher']['type'] ) ) {\n-\t\t\t\t\t$publisher_organization = $metadata['publisher']['type'];\n-\t\t\t\t}\n-\n-\t\t\t\t$blog_item = (object) array(\n-\t\t\t\t\t'@type'         => 'BlogPosting',\n-\t\t\t\t\t'headline'      => self::get_entry_title( $entry ),\n-\t\t\t\t\t'url'           => $entry->share_link,\n-\t\t\t\t\t'datePublished' => date( 'c', $entry->entry_time ),\n-\t\t\t\t\t'dateModified'  => date( 'c', $entry->timestamp ),\n-\t\t\t\t\t'author'        => (object) array(\n-\t\t\t\t\t\t'@type' => 'Person',\n-\t\t\t\t\t\t'name'  => $entry->authors[0]['name'],\n-\t\t\t\t\t),\n-\t\t\t\t\t'articleBody'   => (object) array(\n-\t\t\t\t\t\t'@type' => 'Text',\n-\t\t\t\t\t),\n-\t\t\t\t\t'publisher'     => (object) array(\n-\t\t\t\t\t\t'@type' => $publisher_organization,\n-\t\t\t\t\t\t'name'  => $publisher_name,\n-\t\t\t\t\t),\n-\t\t\t\t);\n-\n-\t\t\t\tarray_push( $blog_updates, $blog_item );\n+\t\tif ( ! isset( $entries[ 'entries' ] ) || ! is_array( $entries[ 'entries' ] ) ) {\n+\t\t\treturn $metadata;\n+\t\t}\n+\n+\t\tforeach ( $entries[ 'entries' ] as $key => $entry ) {\n+\t\t\t$blog_item = [\n+\t\t\t\t'@type'            => 'BlogPosting',\n+\t\t\t\t'headline'         => self::get_entry_title( $entry ),\n+\t\t\t\t'url'              => $entry->share_link,\n+\t\t\t\t'mainEntityOfPage' => $entry->share_link,\n+\t\t\t\t'datePublished'    => date( 'c', $entry->entry_time ),\n+\t\t\t\t'dateModified'     => date( 'c', $entry->timestamp ),\n+\t\t\t\t'author'           => [\n+\t\t\t\t\t'@type' => 'Person',\n+\t\t\t\t\t'name'  => $entry->authors[ 0 ][ 'name' ],\n+\t\t\t\t],\n+\t\t\t\t'articleBody'      => [\n+\t\t\t\t\t'@type' => 'Text',\n+\t\t\t\t],\n+\t\t\t];\n+\n+\t\t\tif ( isset( $metadata['publisher'] ) ) {\n+\t\t\t\t$blog_item['publisher'] = $metadata['publisher'];\n \t\t\t}\n \n-\t\t\t$metadata['@type']          = 'LiveBlogPosting';\n-\t\t\t$metadata['liveBlogUpdate'] = $blog_updates;\n+\t\t\t$blog_updates[] = json_decode( json_encode( $blog_item ) );","path":"classes/class-wpcom-liveblog-amp.php","position":69,"original_position":69,"commit_id":"6b5b1d2bc44d64d371131b51a98cca330283ba09","original_commit_id":"6b5b1d2bc44d64d371131b51a98cca330283ba09","user":{"login":"philipjohn","id":136342,"node_id":"MDQ6VXNlcjEzNjM0Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/136342?v=4","gravatar_id":"","url":"https://api.github.com/users/philipjohn","html_url":"https://github.com/philipjohn","followers_url":"https://api.github.com/users/philipjohn/followers","following_url":"https://api.github.com/users/philipjohn/following{/other_user}","gists_url":"https://api.github.com/users/philipjohn/gists{/gist_id}","starred_url":"https://api.github.com/users/philipjohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipjohn/subscriptions","organizations_url":"https://api.github.com/users/philipjohn/orgs","repos_url":"https://api.github.com/users/philipjohn/repos","events_url":"https://api.github.com/users/philipjohn/events{/privacy}","received_events_url":"https://api.github.com/users/philipjohn/received_events","type":"User","site_admin":false},"body":"Can you elaborate on the need for this change please? I'm not sure I understand what it adds.","created_at":"2018-08-12T11:03:10Z","updated_at":"2018-08-12T11:05:08Z","html_url":"https://github.com/Automattic/liveblog/pull/509#discussion_r209451163","pull_request_url":"https://api.github.com/repos/Automattic/liveblog/pulls/509","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Automattic/liveblog/pulls/comments/209451163"},"html":{"href":"https://github.com/Automattic/liveblog/pull/509#discussion_r209451163"},"pull_request":{"href":"https://api.github.com/repos/Automattic/liveblog/pulls/509"}}},"pull_request":{"url":"https://api.github.com/repos/Automattic/liveblog/pulls/509","id":206672993,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2NjcyOTkz","html_url":"https://github.com/Automattic/liveblog/pull/509","diff_url":"https://github.com/Automattic/liveblog/pull/509.diff","patch_url":"https://github.com/Automattic/liveblog/pull/509.patch","issue_url":"https://api.github.com/repos/Automattic/liveblog/issues/509","number":509,"state":"open","locked":false,"title":"AMP schema refactor","user":{"login":"GaryJones","id":88371,"node_id":"MDQ6VXNlcjg4Mzcx","avatar_url":"https://avatars2.githubusercontent.com/u/88371?v=4","gravatar_id":"","url":"https://api.github.com/users/GaryJones","html_url":"https://github.com/GaryJones","followers_url":"https://api.github.com/users/GaryJones/followers","following_url":"https://api.github.com/users/GaryJones/following{/other_user}","gists_url":"https://api.github.com/users/GaryJones/gists{/gist_id}","starred_url":"https://api.github.com/users/GaryJones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GaryJones/subscriptions","organizations_url":"https://api.github.com/users/GaryJones/orgs","repos_url":"https://api.github.com/users/GaryJones/repos","events_url":"https://api.github.com/users/GaryJones/events{/privacy}","received_events_url":"https://api.github.com/users/GaryJones/received_events","type":"User","site_admin":false},"body":"This is the first step of fixing some of the issues in #506, and refactoring the code to aid with #505.\r\n\r\nSee individual commits for more info.","created_at":"2018-08-07T11:56:28Z","updated_at":"2018-08-12T11:05:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e81ad5e033e5c40fc190d2f0527577079b232b2","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Automattic/liveblog/pulls/509/commits","review_comments_url":"https://api.github.com/repos/Automattic/liveblog/pulls/509/comments","review_comment_url":"https://api.github.com/repos/Automattic/liveblog/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Automattic/liveblog/issues/509/comments","statuses_url":"https://api.github.com/repos/Automattic/liveblog/statuses/6b5b1d2bc44d64d371131b51a98cca330283ba09","head":{"label":"GaryJones:feature/schema-refactor","ref":"feature/schema-refactor","sha":"6b5b1d2bc44d64d371131b51a98cca330283ba09","user":{"login":"GaryJones","id":88371,"node_id":"MDQ6VXNlcjg4Mzcx","avatar_url":"https://avatars2.githubusercontent.com/u/88371?v=4","gravatar_id":"","url":"https://api.github.com/users/GaryJones","html_url":"https://github.com/GaryJones","followers_url":"https://api.github.com/users/GaryJones/followers","following_url":"https://api.github.com/users/GaryJones/following{/other_user}","gists_url":"https://api.github.com/users/GaryJones/gists{/gist_id}","starred_url":"https://api.github.com/users/GaryJones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GaryJones/subscriptions","organizations_url":"https://api.github.com/users/GaryJones/orgs","repos_url":"https://api.github.com/users/GaryJones/repos","events_url":"https://api.github.com/users/GaryJones/events{/privacy}","received_events_url":"https://api.github.com/users/GaryJones/received_events","type":"User","site_admin":false},"repo":{"id":143857056,"node_id":"MDEwOlJlcG9zaXRvcnkxNDM4NTcwNTY=","name":"liveblog","full_name":"GaryJones/liveblog","owner":{"login":"GaryJones","id":88371,"node_id":"MDQ6VXNlcjg4Mzcx","avatar_url":"https://avatars2.githubusercontent.com/u/88371?v=4","gravatar_id":"","url":"https://api.github.com/users/GaryJones","html_url":"https://github.com/GaryJones","followers_url":"https://api.github.com/users/GaryJones/followers","following_url":"https://api.github.com/users/GaryJones/following{/other_user}","gists_url":"https://api.github.com/users/GaryJones/gists{/gist_id}","starred_url":"https://api.github.com/users/GaryJones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GaryJones/subscriptions","organizations_url":"https://api.github.com/users/GaryJones/orgs","repos_url":"https://api.github.com/users/GaryJones/repos","events_url":"https://api.github.com/users/GaryJones/events{/privacy}","received_events_url":"https://api.github.com/users/GaryJones/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GaryJones/liveblog","description":"Liveblogging done right. Using WordPress.","fork":true,"url":"https://api.github.com/repos/GaryJones/liveblog","forks_url":"https://api.github.com/repos/GaryJones/liveblog/forks","keys_url":"https://api.github.com/repos/GaryJones/liveblog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GaryJones/liveblog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GaryJones/liveblog/teams","hooks_url":"https://api.github.com/repos/GaryJones/liveblog/hooks","issue_events_url":"https://api.github.com/repos/GaryJones/liveblog/issues/events{/number}","events_url":"https://api.github.com/repos/GaryJones/liveblog/events","assignees_url":"https://api.github.com/repos/GaryJones/liveblog/assignees{/user}","branches_url":"https://api.github.com/repos/GaryJones/liveblog/branches{/branch}","tags_url":"https://api.github.com/repos/GaryJones/liveblog/tags","blobs_url":"https://api.github.com/repos/GaryJones/liveblog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GaryJones/liveblog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GaryJones/liveblog/git/refs{/sha}","trees_url":"https://api.github.com/repos/GaryJones/liveblog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GaryJones/liveblog/statuses/{sha}","languages_url":"https://api.github.com/repos/GaryJones/liveblog/languages","stargazers_url":"https://api.github.com/repos/GaryJones/liveblog/stargazers","contributors_url":"https://api.github.com/repos/GaryJones/liveblog/contributors","subscribers_url":"https://api.github.com/repos/GaryJones/liveblog/subscribers","subscription_url":"https://api.github.com/repos/GaryJones/liveblog/subscription","commits_url":"https://api.github.com/repos/GaryJones/liveblog/commits{/sha}","git_commits_url":"https://api.github.com/repos/GaryJones/liveblog/git/commits{/sha}","comments_url":"https://api.github.com/repos/GaryJones/liveblog/comments{/number}","issue_comment_url":"https://api.github.com/repos/GaryJones/liveblog/issues/comments{/number}","contents_url":"https://api.github.com/repos/GaryJones/liveblog/contents/{+path}","compare_url":"https://api.github.com/repos/GaryJones/liveblog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GaryJones/liveblog/merges","archive_url":"https://api.github.com/repos/GaryJones/liveblog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GaryJones/liveblog/downloads","issues_url":"https://api.github.com/repos/GaryJones/liveblog/issues{/number}","pulls_url":"https://api.github.com/repos/GaryJones/liveblog/pulls{/number}","milestones_url":"https://api.github.com/repos/GaryJones/liveblog/milestones{/number}","notifications_url":"https://api.github.com/repos/GaryJones/liveblog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GaryJones/liveblog/labels{/name}","releases_url":"https://api.github.com/repos/GaryJones/liveblog/releases{/id}","deployments_url":"https://api.github.com/repos/GaryJones/liveblog/deployments","created_at":"2018-08-07T10:22:20Z","updated_at":"2018-08-07T10:22:23Z","pushed_at":"2018-08-07T16:33:18Z","git_url":"git://github.com/GaryJones/liveblog.git","ssh_url":"git@github.com:GaryJones/liveblog.git","clone_url":"https://github.com/GaryJones/liveblog.git","svn_url":"https://github.com/GaryJones/liveblog","homepage":"https://wordpress.org/plugins/liveblog/","size":30732,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"fd833bb0d5788b13e5fc421641491fb185393024","user":{"login":"Automattic","id":887802,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4NzgwMg==","avatar_url":"https://avatars1.githubusercontent.com/u/887802?v=4","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":4542883,"node_id":"MDEwOlJlcG9zaXRvcnk0NTQyODgz","name":"liveblog","full_name":"Automattic/liveblog","owner":{"login":"Automattic","id":887802,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4NzgwMg==","avatar_url":"https://avatars1.githubusercontent.com/u/887802?v=4","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/liveblog","description":"Liveblogging done right. Using WordPress.","fork":false,"url":"https://api.github.com/repos/Automattic/liveblog","forks_url":"https://api.github.com/repos/Automattic/liveblog/forks","keys_url":"https://api.github.com/repos/Automattic/liveblog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/liveblog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/liveblog/teams","hooks_url":"https://api.github.com/repos/Automattic/liveblog/hooks","issue_events_url":"https://api.github.com/repos/Automattic/liveblog/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/liveblog/events","assignees_url":"https://api.github.com/repos/Automattic/liveblog/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/liveblog/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/liveblog/tags","blobs_url":"https://api.github.com/repos/Automattic/liveblog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/liveblog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/liveblog/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/liveblog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/liveblog/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/liveblog/languages","stargazers_url":"https://api.github.com/repos/Automattic/liveblog/stargazers","contributors_url":"https://api.github.com/repos/Automattic/liveblog/contributors","subscribers_url":"https://api.github.com/repos/Automattic/liveblog/subscribers","subscription_url":"https://api.github.com/repos/Automattic/liveblog/subscription","commits_url":"https://api.github.com/repos/Automattic/liveblog/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/liveblog/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/liveblog/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/liveblog/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/liveblog/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/liveblog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/liveblog/merges","archive_url":"https://api.github.com/repos/Automattic/liveblog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/liveblog/downloads","issues_url":"https://api.github.com/repos/Automattic/liveblog/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/liveblog/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/liveblog/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/liveblog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/liveblog/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/liveblog/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/liveblog/deployments","created_at":"2012-06-04T03:14:54Z","updated_at":"2018-07-30T18:58:38Z","pushed_at":"2018-08-09T14:03:42Z","git_url":"git://github.com/Automattic/liveblog.git","ssh_url":"git@github.com:Automattic/liveblog.git","clone_url":"https://github.com/Automattic/liveblog.git","svn_url":"https://github.com/Automattic/liveblog","homepage":"https://wordpress.org/plugins/liveblog/","size":30732,"stargazers_count":277,"watchers_count":277,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":104,"mirror_url":null,"archived":false,"open_issues_count":132,"license":null,"forks":104,"open_issues":132,"watchers":277,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/liveblog/pulls/509"},"html":{"href":"https://github.com/Automattic/liveblog/pull/509"},"issue":{"href":"https://api.github.com/repos/Automattic/liveblog/issues/509"},"comments":{"href":"https://api.github.com/repos/Automattic/liveblog/issues/509/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/liveblog/pulls/509/comments"},"review_comment":{"href":"https://api.github.com/repos/Automattic/liveblog/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Automattic/liveblog/pulls/509/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/liveblog/statuses/6b5b1d2bc44d64d371131b51a98cca330283ba09"}},"author_association":"NONE"}}
{"actor":{"display_login":"philipjohn"}}