{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/jetpack/pulls/comments/55001534","id":55001534,"diff_hunk":"@@ -3872,6 +3876,31 @@ function disconnect_survey_notice() {\n \t\t<?php\n \t}\n \n+\t/**\n+\t * Checks if the user have started a register flow from calypso in the last day, and if so, redirect them there\n+\t */\n+\tfunction check_jetpack_connect_redirection() {\n+\t\t$user = $this->get_connected_user_data();\n+\t\t$parsed_site = parse_url( get_site_url() );\n+\n+\t\tif ( isset( $user[ 'jetpack_connect' ] ) && is_array( $user[ 'jetpack_connect' ] ) ) {\n+\t\t\tforeach ($user[ 'jetpack_connect' ] as $jetpack_connect_request ) {\n+\t\t\t\t$parsed_jetpack_connect_site = $jetpack_connect_request[ 'site_url' ];\n+\n+\t\t\t\tif ( $parsed_jetpack_connect_site->domain == $parsed_site->domain\n+\t\t\t\t\t&& $parsed_jetpack_connect_site->path == $parsed_site->path\n+\t\t\t\t\t&& ( time() - $this->JETPACK_CONNECT_TIMEOUT ) < strtotime( $jetpack_connect_request[ 'date' ] ) ) {\n+\t\t\t\t\t// the user started a flow from calypso registering this site url in the last 24 hours\n+\t\t\t\t\t$this->message .= __( '<div> Let us take you back to WordPress.com.</div>' );","path":"class.jetpack.php","position":30,"original_position":30,"commit_id":"6cba20eeddc224661406c5d04620589b3bc5cacf","original_commit_id":"6cba20eeddc224661406c5d04620589b3bc5cacf","user":{"login":"zinigor","id":374293,"avatar_url":"https://avatars.githubusercontent.com/u/374293?v=3","gravatar_id":"","url":"https://api.github.com/users/zinigor","html_url":"https://github.com/zinigor","followers_url":"https://api.github.com/users/zinigor/followers","following_url":"https://api.github.com/users/zinigor/following{/other_user}","gists_url":"https://api.github.com/users/zinigor/gists{/gist_id}","starred_url":"https://api.github.com/users/zinigor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zinigor/subscriptions","organizations_url":"https://api.github.com/users/zinigor/orgs","repos_url":"https://api.github.com/users/zinigor/repos","events_url":"https://api.github.com/users/zinigor/events{/privacy}","received_events_url":"https://api.github.com/users/zinigor/received_events","type":"User","site_admin":false},"body":"I have to add to that :) Usually it's OK to have html inside translations if it is unavoidable, or hard to carry out, as in case with links. But in this case it appears fairly easy to move the wrapping html out, so why not do it?","created_at":"2016-03-04T08:20:54Z","updated_at":"2016-03-04T08:20:54Z","html_url":"https://github.com/Automattic/jetpack/pull/3500#discussion_r55001534","pull_request_url":"https://api.github.com/repos/Automattic/jetpack/pulls/3500","_links":{"self":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/comments/55001534"},"html":{"href":"https://github.com/Automattic/jetpack/pull/3500#discussion_r55001534"},"pull_request":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/3500"}}},"pull_request":{"url":"https://api.github.com/repos/Automattic/jetpack/pulls/3500","id":61578389,"html_url":"https://github.com/Automattic/jetpack/pull/3500","diff_url":"https://github.com/Automattic/jetpack/pull/3500.diff","patch_url":"https://github.com/Automattic/jetpack/pull/3500.patch","issue_url":"https://api.github.com/repos/Automattic/jetpack/issues/3500","number":3500,"state":"open","locked":false,"title":"Jetpack-connect: Redirect the user to WordPress.com","user":{"login":"johnHackworth","id":1554855,"avatar_url":"https://avatars.githubusercontent.com/u/1554855?v=3","gravatar_id":"","url":"https://api.github.com/users/johnHackworth","html_url":"https://github.com/johnHackworth","followers_url":"https://api.github.com/users/johnHackworth/followers","following_url":"https://api.github.com/users/johnHackworth/following{/other_user}","gists_url":"https://api.github.com/users/johnHackworth/gists{/gist_id}","starred_url":"https://api.github.com/users/johnHackworth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnHackworth/subscriptions","organizations_url":"https://api.github.com/users/johnHackworth/orgs","repos_url":"https://api.github.com/users/johnHackworth/repos","events_url":"https://api.github.com/users/johnHackworth/events{/privacy}","received_events_url":"https://api.github.com/users/johnHackworth/received_events","type":"User","site_admin":false},"body":"Fixes https://github.com/Automattic/jetpack/issues/3498\r\n\r\nRequires to run against a WordPress.com sandbox with #D3158-code applied to work.\r\n\r\nThis PR adds a check when the user completes their WordPress.com connection process to see if they have started this connection flow from wp-calypso in the last day, and, if they did, redirects users automatically back to the WordPress.com flow.\r\n\r\nYou can read about the motivation for this change in the issue it solves.\r\n\r\nThe address where the user is going to be redirected may change once we set up a more complex jetpack-connect flow in calypso.\r\n\r\nHow to test\r\n========\r\nYou need to apply #D3158-code patch to your WordPress.com sandbox. After that, you can create a jetpack-connect request sending a POST request to `/v1.1/me/settings` with `jetpack_connect=url-of-your-site` in the body. Once you do this, during the next day, if you connect jetpack to your WordPress.com account in said site, you should be redirected back to WordPress.com \r\n\r\n","created_at":"2016-03-03T15:46:22Z","updated_at":"2016-03-04T08:20:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"878e63eb1c0a7ddd1e0eceeb7f97998919154f24","assignee":{"login":"johnHackworth","id":1554855,"avatar_url":"https://avatars.githubusercontent.com/u/1554855?v=3","gravatar_id":"","url":"https://api.github.com/users/johnHackworth","html_url":"https://github.com/johnHackworth","followers_url":"https://api.github.com/users/johnHackworth/followers","following_url":"https://api.github.com/users/johnHackworth/following{/other_user}","gists_url":"https://api.github.com/users/johnHackworth/gists{/gist_id}","starred_url":"https://api.github.com/users/johnHackworth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnHackworth/subscriptions","organizations_url":"https://api.github.com/users/johnHackworth/orgs","repos_url":"https://api.github.com/users/johnHackworth/repos","events_url":"https://api.github.com/users/johnHackworth/events{/privacy}","received_events_url":"https://api.github.com/users/johnHackworth/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/Automattic/jetpack/pulls/3500/commits","review_comments_url":"https://api.github.com/repos/Automattic/jetpack/pulls/3500/comments","review_comment_url":"https://api.github.com/repos/Automattic/jetpack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Automattic/jetpack/issues/3500/comments","statuses_url":"https://api.github.com/repos/Automattic/jetpack/statuses/6cba20eeddc224661406c5d04620589b3bc5cacf","head":{"label":"Automattic:add/jetpack-connect-redirection","ref":"add/jetpack-connect-redirection","sha":"6cba20eeddc224661406c5d04620589b3bc5cacf","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":15231212,"name":"jetpack","full_name":"Automattic/jetpack","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/jetpack","description":"Increase your traffic, view your stats, speed up your site, and protect yourself from hackers with Jetpack.","fork":false,"url":"https://api.github.com/repos/Automattic/jetpack","forks_url":"https://api.github.com/repos/Automattic/jetpack/forks","keys_url":"https://api.github.com/repos/Automattic/jetpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/jetpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/jetpack/teams","hooks_url":"https://api.github.com/repos/Automattic/jetpack/hooks","issue_events_url":"https://api.github.com/repos/Automattic/jetpack/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/jetpack/events","assignees_url":"https://api.github.com/repos/Automattic/jetpack/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/jetpack/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/jetpack/tags","blobs_url":"https://api.github.com/repos/Automattic/jetpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/jetpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/jetpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/jetpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/jetpack/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/jetpack/languages","stargazers_url":"https://api.github.com/repos/Automattic/jetpack/stargazers","contributors_url":"https://api.github.com/repos/Automattic/jetpack/contributors","subscribers_url":"https://api.github.com/repos/Automattic/jetpack/subscribers","subscription_url":"https://api.github.com/repos/Automattic/jetpack/subscription","commits_url":"https://api.github.com/repos/Automattic/jetpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/jetpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/jetpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/jetpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/jetpack/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/jetpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/jetpack/merges","archive_url":"https://api.github.com/repos/Automattic/jetpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/jetpack/downloads","issues_url":"https://api.github.com/repos/Automattic/jetpack/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/jetpack/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/jetpack/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/jetpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/jetpack/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/jetpack/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/jetpack/deployments","created_at":"2013-12-16T16:43:01Z","updated_at":"2016-03-03T20:18:17Z","pushed_at":"2016-03-04T07:04:17Z","git_url":"git://github.com/Automattic/jetpack.git","ssh_url":"git@github.com:Automattic/jetpack.git","clone_url":"https://github.com/Automattic/jetpack.git","svn_url":"https://github.com/Automattic/jetpack","homepage":"http://jetpack.me","size":74087,"stargazers_count":510,"watchers_count":510,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":302,"mirror_url":null,"open_issues_count":646,"forks":302,"open_issues":646,"watchers":510,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"3a8d0a9fa9630a8d6de62e969a81b59693d13348","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":15231212,"name":"jetpack","full_name":"Automattic/jetpack","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/jetpack","description":"Increase your traffic, view your stats, speed up your site, and protect yourself from hackers with Jetpack.","fork":false,"url":"https://api.github.com/repos/Automattic/jetpack","forks_url":"https://api.github.com/repos/Automattic/jetpack/forks","keys_url":"https://api.github.com/repos/Automattic/jetpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/jetpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/jetpack/teams","hooks_url":"https://api.github.com/repos/Automattic/jetpack/hooks","issue_events_url":"https://api.github.com/repos/Automattic/jetpack/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/jetpack/events","assignees_url":"https://api.github.com/repos/Automattic/jetpack/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/jetpack/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/jetpack/tags","blobs_url":"https://api.github.com/repos/Automattic/jetpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/jetpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/jetpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/jetpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/jetpack/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/jetpack/languages","stargazers_url":"https://api.github.com/repos/Automattic/jetpack/stargazers","contributors_url":"https://api.github.com/repos/Automattic/jetpack/contributors","subscribers_url":"https://api.github.com/repos/Automattic/jetpack/subscribers","subscription_url":"https://api.github.com/repos/Automattic/jetpack/subscription","commits_url":"https://api.github.com/repos/Automattic/jetpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/jetpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/jetpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/jetpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/jetpack/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/jetpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/jetpack/merges","archive_url":"https://api.github.com/repos/Automattic/jetpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/jetpack/downloads","issues_url":"https://api.github.com/repos/Automattic/jetpack/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/jetpack/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/jetpack/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/jetpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/jetpack/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/jetpack/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/jetpack/deployments","created_at":"2013-12-16T16:43:01Z","updated_at":"2016-03-03T20:18:17Z","pushed_at":"2016-03-04T07:04:17Z","git_url":"git://github.com/Automattic/jetpack.git","ssh_url":"git@github.com:Automattic/jetpack.git","clone_url":"https://github.com/Automattic/jetpack.git","svn_url":"https://github.com/Automattic/jetpack","homepage":"http://jetpack.me","size":74087,"stargazers_count":510,"watchers_count":510,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":302,"mirror_url":null,"open_issues_count":646,"forks":302,"open_issues":646,"watchers":510,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/3500"},"html":{"href":"https://github.com/Automattic/jetpack/pull/3500"},"issue":{"href":"https://api.github.com/repos/Automattic/jetpack/issues/3500"},"comments":{"href":"https://api.github.com/repos/Automattic/jetpack/issues/3500/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/3500/comments"},"review_comment":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Automattic/jetpack/pulls/3500/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/jetpack/statuses/6cba20eeddc224661406c5d04620589b3bc5cacf"}}}}