{"action":"created","comment":{"url":"https://api.github.com/repos/xwp/wp-customize-posts/pulls/comments/64523381","id":64523381,"diff_hunk":"@@ -165,6 +166,91 @@ public function filter_the_posts_to_preview_settings( array $posts ) {\n \t}\n \n \t/**\n+\t * Get current posts being previewed which should be included in the given query.\n+\t *\n+\t * @access public\n+\t *\n+\t * @param \\WP_Query $query The query.\n+\t * @return array\n+\t */\n+\tpublic function get_previewed_posts_for_query( WP_Query $query ) {\n+\t\t$query_vars = $query->query_vars;\n+\n+\t\tif ( empty( $query_vars['post_type'] ) ) {\n+\t\t\t$query_vars['post_type'] = array( 'post' );\n+\t\t} elseif ( is_string( $query_vars['post_type'] ) ) {\n+\t\t\t$query_vars['post_type'] = explode( ',', $query_vars['post_type'] );\n+\t\t}\n+\n+\t\tif ( empty( $query_vars['post_status'] ) ) {\n+\t\t\t$query_vars['post_status'] = array( 'publish' );\n+\t\t} elseif ( is_string( $query_vars['post_status'] ) ) {\n+\t\t\t$query_vars['post_status'] = explode( ',', $query_vars['post_status'] );\n+\t\t}\n+\n+\t\t$post_ids = array();\n+\t\t$settings = $this->component->manager->unsanitized_post_values();\n+\t\tif ( ! empty( $settings ) ) {\n+\t\t\tforeach ( (array) $settings as $id => $post_data ) {\n+\t\t\t\tif ( ! preg_match( WP_Customize_Post_Setting::SETTING_ID_PATTERN, $id, $matches ) ) {\n+\t\t\t\t\tcontinue;\n+\t\t\t\t}\n+\n+\t\t\t\t/**\n+\t\t\t\t * Filter the post type used in the main query.\n+\t\t\t\t *\n+\t\t\t\t * @param string $post_type         Main query post type.\n+\t\t\t\t * @param string $setting_post_type Current setting post type.\n+\t\t\t\t */\n+\t\t\t\t$main_query_post_type = apply_filters( 'customize_posts_main_query_post_type', 'post', $matches['post_type'] );","path":"php/class-wp-customize-posts-preview.php","position":null,"original_position":48,"commit_id":"9cdcb7c6594331f3298c81f9e963cdc43d5dac3d","original_commit_id":"06b180ca80e223978d03d49e991c39c7d686056f","user":{"login":"westonruter","id":134745,"avatar_url":"https://avatars.githubusercontent.com/u/134745?v=3","gravatar_id":"","url":"https://api.github.com/users/westonruter","html_url":"https://github.com/westonruter","followers_url":"https://api.github.com/users/westonruter/followers","following_url":"https://api.github.com/users/westonruter/following{/other_user}","gists_url":"https://api.github.com/users/westonruter/gists{/gist_id}","starred_url":"https://api.github.com/users/westonruter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/westonruter/subscriptions","organizations_url":"https://api.github.com/users/westonruter/orgs","repos_url":"https://api.github.com/users/westonruter/repos","events_url":"https://api.github.com/users/westonruter/events{/privacy}","received_events_url":"https://api.github.com/users/westonruter/received_events","type":"User","site_admin":false},"body":"OK, done in https://github.com/xwp/wp-customize-posts/commit/9cdcb7c6594331f3298c81f9e963cdc43d5dac3d","created_at":"2016-05-25T06:55:27Z","updated_at":"2016-05-25T06:55:27Z","html_url":"https://github.com/xwp/wp-customize-posts/pull/134#discussion_r64523381","pull_request_url":"https://api.github.com/repos/xwp/wp-customize-posts/pulls/134","_links":{"self":{"href":"https://api.github.com/repos/xwp/wp-customize-posts/pulls/comments/64523381"},"html":{"href":"https://github.com/xwp/wp-customize-posts/pull/134#discussion_r64523381"},"pull_request":{"href":"https://api.github.com/repos/xwp/wp-customize-posts/pulls/134"}}},"pull_request":{"url":"https://api.github.com/repos/xwp/wp-customize-posts/pulls/134","id":69705117,"html_url":"https://github.com/xwp/wp-customize-posts/pull/134","diff_url":"https://github.com/xwp/wp-customize-posts/pull/134.diff","patch_url":"https://github.com/xwp/wp-customize-posts/pull/134.patch","issue_url":"https://api.github.com/repos/xwp/wp-customize-posts/issues/134","number":134,"state":"open","locked":false,"title":"Post Creation","user":{"login":"valendesigns","id":62798,"avatar_url":"https://avatars.githubusercontent.com/u/62798?v=3","gravatar_id":"","url":"https://api.github.com/users/valendesigns","html_url":"https://github.com/valendesigns","followers_url":"https://api.github.com/users/valendesigns/followers","following_url":"https://api.github.com/users/valendesigns/following{/other_user}","gists_url":"https://api.github.com/users/valendesigns/gists{/gist_id}","starred_url":"https://api.github.com/users/valendesigns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valendesigns/subscriptions","organizations_url":"https://api.github.com/users/valendesigns/orgs","repos_url":"https://api.github.com/users/valendesigns/repos","events_url":"https://api.github.com/users/valendesigns/events{/privacy}","received_events_url":"https://api.github.com/users/valendesigns/received_events","type":"User","site_admin":false},"body":"Fixes #48, fixes #50\r\n\r\n- [x] Create a new post/page and reload the preview while giving focus to that section\r\n- [x] Ensure any newly created post/page persist in the panel\r\n- [x] Add a `customize-draft` status which is assigned to an `auto-draft` post once it has been saved as part of a snapshot. This will prevent it from being garbage-collected.\r\n- [x] Add link in a post section to allow navigating back to the post/page in the preview after having navigated away.\r\n- [x] Display Ajax error messages in the console\r\n- [x] Add unit tests\r\n- [x] Rework the dependency on refreshing the preview to see new posts in the panel","created_at":"2016-05-11T16:48:06Z","updated_at":"2016-05-25T06:55:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"96666bdb429e7b41e573f4a0c6c3b349e8d00ea1","assignee":null,"milestone":{"url":"https://api.github.com/repos/xwp/wp-customize-posts/milestones/3","html_url":"https://github.com/xwp/wp-customize-posts/milestones/0.6","labels_url":"https://api.github.com/repos/xwp/wp-customize-posts/milestones/3/labels","id":1673111,"number":3,"title":"0.6","description":"","creator":{"login":"valendesigns","id":62798,"avatar_url":"https://avatars.githubusercontent.com/u/62798?v=3","gravatar_id":"","url":"https://api.github.com/users/valendesigns","html_url":"https://github.com/valendesigns","followers_url":"https://api.github.com/users/valendesigns/followers","following_url":"https://api.github.com/users/valendesigns/following{/other_user}","gists_url":"https://api.github.com/users/valendesigns/gists{/gist_id}","starred_url":"https://api.github.com/users/valendesigns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valendesigns/subscriptions","organizations_url":"https://api.github.com/users/valendesigns/orgs","repos_url":"https://api.github.com/users/valendesigns/repos","events_url":"https://api.github.com/users/valendesigns/events{/privacy}","received_events_url":"https://api.github.com/users/valendesigns/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":6,"state":"open","created_at":"2016-03-30T01:41:38Z","updated_at":"2016-05-25T05:44:55Z","due_on":"2016-05-16T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/xwp/wp-customize-posts/pulls/134/commits","review_comments_url":"https://api.github.com/repos/xwp/wp-customize-posts/pulls/134/comments","review_comment_url":"https://api.github.com/repos/xwp/wp-customize-posts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xwp/wp-customize-posts/issues/134/comments","statuses_url":"https://api.github.com/repos/xwp/wp-customize-posts/statuses/9cdcb7c6594331f3298c81f9e963cdc43d5dac3d","head":{"label":"xwp:feature/authoring","ref":"feature/authoring","sha":"9cdcb7c6594331f3298c81f9e963cdc43d5dac3d","user":{"login":"xwp","id":9003139,"avatar_url":"https://avatars.githubusercontent.com/u/9003139?v=3","gravatar_id":"","url":"https://api.github.com/users/xwp","html_url":"https://github.com/xwp","followers_url":"https://api.github.com/users/xwp/followers","following_url":"https://api.github.com/users/xwp/following{/other_user}","gists_url":"https://api.github.com/users/xwp/gists{/gist_id}","starred_url":"https://api.github.com/users/xwp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xwp/subscriptions","organizations_url":"https://api.github.com/users/xwp/orgs","repos_url":"https://api.github.com/users/xwp/repos","events_url":"https://api.github.com/users/xwp/events{/privacy}","received_events_url":"https://api.github.com/users/xwp/received_events","type":"Organization","site_admin":false},"repo":{"id":19420787,"name":"wp-customize-posts","full_name":"xwp/wp-customize-posts","owner":{"login":"xwp","id":9003139,"avatar_url":"https://avatars.githubusercontent.com/u/9003139?v=3","gravatar_id":"","url":"https://api.github.com/users/xwp","html_url":"https://github.com/xwp","followers_url":"https://api.github.com/users/xwp/followers","following_url":"https://api.github.com/users/xwp/following{/other_user}","gists_url":"https://api.github.com/users/xwp/gists{/gist_id}","starred_url":"https://api.github.com/users/xwp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xwp/subscriptions","organizations_url":"https://api.github.com/users/xwp/orgs","repos_url":"https://api.github.com/users/xwp/repos","events_url":"https://api.github.com/users/xwp/events{/privacy}","received_events_url":"https://api.github.com/users/xwp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xwp/wp-customize-posts","description":"Edit posts and postmeta in the WordPress Customizer","fork":false,"url":"https://api.github.com/repos/xwp/wp-customize-posts","forks_url":"https://api.github.com/repos/xwp/wp-customize-posts/forks","keys_url":"https://api.github.com/repos/xwp/wp-customize-posts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xwp/wp-customize-posts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xwp/wp-customize-posts/teams","hooks_url":"https://api.github.com/repos/xwp/wp-customize-posts/hooks","issue_events_url":"https://api.github.com/repos/xwp/wp-customize-posts/issues/events{/number}","events_url":"https://api.github.com/repos/xwp/wp-customize-posts/events","assignees_url":"https://api.github.com/repos/xwp/wp-customize-posts/assignees{/user}","branches_url":"https://api.github.com/repos/xwp/wp-customize-posts/branches{/branch}","tags_url":"https://api.github.com/repos/xwp/wp-customize-posts/tags","blobs_url":"https://api.github.com/repos/xwp/wp-customize-posts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xwp/wp-customize-posts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xwp/wp-customize-posts/git/refs{/sha}","trees_url":"https://api.github.com/repos/xwp/wp-customize-posts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xwp/wp-customize-posts/statuses/{sha}","languages_url":"https://api.github.com/repos/xwp/wp-customize-posts/languages","stargazers_url":"https://api.github.com/repos/xwp/wp-customize-posts/stargazers","contributors_url":"https://api.github.com/repos/xwp/wp-customize-posts/contributors","subscribers_url":"https://api.github.com/repos/xwp/wp-customize-posts/subscribers","subscription_url":"https://api.github.com/repos/xwp/wp-customize-posts/subscription","commits_url":"https://api.github.com/repos/xwp/wp-customize-posts/commits{/sha}","git_commits_url":"https://api.github.com/repos/xwp/wp-customize-posts/git/commits{/sha}","comments_url":"https://api.github.com/repos/xwp/wp-customize-posts/comments{/number}","issue_comment_url":"https://api.github.com/repos/xwp/wp-customize-posts/issues/comments{/number}","contents_url":"https://api.github.com/repos/xwp/wp-customize-posts/contents/{+path}","compare_url":"https://api.github.com/repos/xwp/wp-customize-posts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xwp/wp-customize-posts/merges","archive_url":"https://api.github.com/repos/xwp/wp-customize-posts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xwp/wp-customize-posts/downloads","issues_url":"https://api.github.com/repos/xwp/wp-customize-posts/issues{/number}","pulls_url":"https://api.github.com/repos/xwp/wp-customize-posts/pulls{/number}","milestones_url":"https://api.github.com/repos/xwp/wp-customize-posts/milestones{/number}","notifications_url":"https://api.github.com/repos/xwp/wp-customize-posts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xwp/wp-customize-posts/labels{/name}","releases_url":"https://api.github.com/repos/xwp/wp-customize-posts/releases{/id}","deployments_url":"https://api.github.com/repos/xwp/wp-customize-posts/deployments","created_at":"2014-05-04T06:57:25Z","updated_at":"2016-05-24T19:50:25Z","pushed_at":"2016-05-25T06:54:45Z","git_url":"git://github.com/xwp/wp-customize-posts.git","ssh_url":"git@github.com:xwp/wp-customize-posts.git","clone_url":"https://github.com/xwp/wp-customize-posts.git","svn_url":"https://github.com/xwp/wp-customize-posts","homepage":"https://wordpress.org/plugins/customize-posts/","size":1801,"stargazers_count":69,"watchers_count":69,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":49,"forks":12,"open_issues":49,"watchers":69,"default_branch":"develop"}},"base":{"label":"xwp:develop","ref":"develop","sha":"ff333522b53c1a124f77592a98ed65989872c699","user":{"login":"xwp","id":9003139,"avatar_url":"https://avatars.githubusercontent.com/u/9003139?v=3","gravatar_id":"","url":"https://api.github.com/users/xwp","html_url":"https://github.com/xwp","followers_url":"https://api.github.com/users/xwp/followers","following_url":"https://api.github.com/users/xwp/following{/other_user}","gists_url":"https://api.github.com/users/xwp/gists{/gist_id}","starred_url":"https://api.github.com/users/xwp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xwp/subscriptions","organizations_url":"https://api.github.com/users/xwp/orgs","repos_url":"https://api.github.com/users/xwp/repos","events_url":"https://api.github.com/users/xwp/events{/privacy}","received_events_url":"https://api.github.com/users/xwp/received_events","type":"Organization","site_admin":false},"repo":{"id":19420787,"name":"wp-customize-posts","full_name":"xwp/wp-customize-posts","owner":{"login":"xwp","id":9003139,"avatar_url":"https://avatars.githubusercontent.com/u/9003139?v=3","gravatar_id":"","url":"https://api.github.com/users/xwp","html_url":"https://github.com/xwp","followers_url":"https://api.github.com/users/xwp/followers","following_url":"https://api.github.com/users/xwp/following{/other_user}","gists_url":"https://api.github.com/users/xwp/gists{/gist_id}","starred_url":"https://api.github.com/users/xwp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xwp/subscriptions","organizations_url":"https://api.github.com/users/xwp/orgs","repos_url":"https://api.github.com/users/xwp/repos","events_url":"https://api.github.com/users/xwp/events{/privacy}","received_events_url":"https://api.github.com/users/xwp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xwp/wp-customize-posts","description":"Edit posts and postmeta in the WordPress Customizer","fork":false,"url":"https://api.github.com/repos/xwp/wp-customize-posts","forks_url":"https://api.github.com/repos/xwp/wp-customize-posts/forks","keys_url":"https://api.github.com/repos/xwp/wp-customize-posts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xwp/wp-customize-posts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xwp/wp-customize-posts/teams","hooks_url":"https://api.github.com/repos/xwp/wp-customize-posts/hooks","issue_events_url":"https://api.github.com/repos/xwp/wp-customize-posts/issues/events{/number}","events_url":"https://api.github.com/repos/xwp/wp-customize-posts/events","assignees_url":"https://api.github.com/repos/xwp/wp-customize-posts/assignees{/user}","branches_url":"https://api.github.com/repos/xwp/wp-customize-posts/branches{/branch}","tags_url":"https://api.github.com/repos/xwp/wp-customize-posts/tags","blobs_url":"https://api.github.com/repos/xwp/wp-customize-posts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xwp/wp-customize-posts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xwp/wp-customize-posts/git/refs{/sha}","trees_url":"https://api.github.com/repos/xwp/wp-customize-posts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xwp/wp-customize-posts/statuses/{sha}","languages_url":"https://api.github.com/repos/xwp/wp-customize-posts/languages","stargazers_url":"https://api.github.com/repos/xwp/wp-customize-posts/stargazers","contributors_url":"https://api.github.com/repos/xwp/wp-customize-posts/contributors","subscribers_url":"https://api.github.com/repos/xwp/wp-customize-posts/subscribers","subscription_url":"https://api.github.com/repos/xwp/wp-customize-posts/subscription","commits_url":"https://api.github.com/repos/xwp/wp-customize-posts/commits{/sha}","git_commits_url":"https://api.github.com/repos/xwp/wp-customize-posts/git/commits{/sha}","comments_url":"https://api.github.com/repos/xwp/wp-customize-posts/comments{/number}","issue_comment_url":"https://api.github.com/repos/xwp/wp-customize-posts/issues/comments{/number}","contents_url":"https://api.github.com/repos/xwp/wp-customize-posts/contents/{+path}","compare_url":"https://api.github.com/repos/xwp/wp-customize-posts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xwp/wp-customize-posts/merges","archive_url":"https://api.github.com/repos/xwp/wp-customize-posts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xwp/wp-customize-posts/downloads","issues_url":"https://api.github.com/repos/xwp/wp-customize-posts/issues{/number}","pulls_url":"https://api.github.com/repos/xwp/wp-customize-posts/pulls{/number}","milestones_url":"https://api.github.com/repos/xwp/wp-customize-posts/milestones{/number}","notifications_url":"https://api.github.com/repos/xwp/wp-customize-posts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xwp/wp-customize-posts/labels{/name}","releases_url":"https://api.github.com/repos/xwp/wp-customize-posts/releases{/id}","deployments_url":"https://api.github.com/repos/xwp/wp-customize-posts/deployments","created_at":"2014-05-04T06:57:25Z","updated_at":"2016-05-24T19:50:25Z","pushed_at":"2016-05-25T06:54:45Z","git_url":"git://github.com/xwp/wp-customize-posts.git","ssh_url":"git@github.com:xwp/wp-customize-posts.git","clone_url":"https://github.com/xwp/wp-customize-posts.git","svn_url":"https://github.com/xwp/wp-customize-posts","homepage":"https://wordpress.org/plugins/customize-posts/","size":1801,"stargazers_count":69,"watchers_count":69,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":49,"forks":12,"open_issues":49,"watchers":69,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/xwp/wp-customize-posts/pulls/134"},"html":{"href":"https://github.com/xwp/wp-customize-posts/pull/134"},"issue":{"href":"https://api.github.com/repos/xwp/wp-customize-posts/issues/134"},"comments":{"href":"https://api.github.com/repos/xwp/wp-customize-posts/issues/134/comments"},"review_comments":{"href":"https://api.github.com/repos/xwp/wp-customize-posts/pulls/134/comments"},"review_comment":{"href":"https://api.github.com/repos/xwp/wp-customize-posts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xwp/wp-customize-posts/pulls/134/commits"},"statuses":{"href":"https://api.github.com/repos/xwp/wp-customize-posts/statuses/9cdcb7c6594331f3298c81f9e963cdc43d5dac3d"}}}}
{"actor":{"display_login":"westonruter"}}