{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/80950808","pull_request_review_id":1966957,"id":80950808,"diff_hunk":"@@ -517,3 +518,95 @@ export function isCurrentSitePlan( state, siteId, planProductId ) {\n \n \treturn sitePlan.product_id === planProductId;\n }\n+\n+export function siteCanUpdateFiles( state, siteId ) {\n+\tif ( ! siteId ) {\n+\t\treturn null;\n+\t}\n+\n+\tif ( ! isJetpackSite( state, siteId ) ) {\n+\t\treturn null;\n+\t}\n+\n+\tif ( ! siteHasMinimumJetpackVersion( state, siteId ) ) {\n+\t\treturn false;\n+\t}\n+\n+\tconst isMultiNetwork = getSiteOption( state, siteId, 'is_multi_network' );","path":"client/state/sites/selectors.js","position":26,"original_position":26,"commit_id":"e71ab9f554e4f502b236cd0c9d499618fcdd2aaa","original_commit_id":"e71ab9f554e4f502b236cd0c9d499618fcdd2aaa","user":{"login":"aduth","id":1779930,"avatar_url":"https://avatars.githubusercontent.com/u/1779930?v=3","gravatar_id":"","url":"https://api.github.com/users/aduth","html_url":"https://github.com/aduth","followers_url":"https://api.github.com/users/aduth/followers","following_url":"https://api.github.com/users/aduth/following{/other_user}","gists_url":"https://api.github.com/users/aduth/gists{/gist_id}","starred_url":"https://api.github.com/users/aduth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aduth/subscriptions","organizations_url":"https://api.github.com/users/aduth/orgs","repos_url":"https://api.github.com/users/aduth/repos","events_url":"https://api.github.com/users/aduth/events{/privacy}","received_events_url":"https://api.github.com/users/aduth/received_events","type":"User","site_admin":false},"body":"Should this be its own selector maybe?","created_at":"2016-09-28T15:50:13Z","updated_at":"2016-09-28T15:55:30Z","html_url":"https://github.com/Automattic/wp-calypso/pull/8197#discussion_r80950808","pull_request_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8197","_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/80950808"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/8197#discussion_r80950808"},"pull_request":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8197"}}},"pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8197","id":86770824,"html_url":"https://github.com/Automattic/wp-calypso/pull/8197","diff_url":"https://github.com/Automattic/wp-calypso/pull/8197.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/8197.patch","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/8197","number":8197,"state":"open","locked":false,"title":"Site state: add jetpack selectors","user":{"login":"retrofox","id":77539,"avatar_url":"https://avatars.githubusercontent.com/u/77539?v=3","gravatar_id":"","url":"https://api.github.com/users/retrofox","html_url":"https://github.com/retrofox","followers_url":"https://api.github.com/users/retrofox/followers","following_url":"https://api.github.com/users/retrofox/following{/other_user}","gists_url":"https://api.github.com/users/retrofox/gists{/gist_id}","starred_url":"https://api.github.com/users/retrofox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retrofox/subscriptions","organizations_url":"https://api.github.com/users/retrofox/orgs","repos_url":"https://api.github.com/users/retrofox/repos","events_url":"https://api.github.com/users/retrofox/events{/privacy}","received_events_url":"https://api.github.com/users/retrofox/received_events","type":"User","site_admin":false},"body":"This PR add some selectors to get data from `state.site` subtree. These selectors have been written bassed on libs that we already have into `client/lib/site/utils.js` and `client/lib/site/jetpack.js`.\r\n\r\nSelector | util function\r\n------------ | -------------\r\n[siteCanUpdateFiles()](https://github.com/Automattic/wp-calypso/blob/fe83917c5ddfcdc45e593fc6546d2aa7f39d4e1d/client/state/sites/selectors.js#L522) | site/utils.js - [canUploadFiles()](https://github.com/Automattic/wp-calypso/blob/master/client/lib/site/utils.js#L97)\r\n[isMainNetworkSite](https://github.com/Automattic/wp-calypso/blob/fe83917c5ddfcdc45e593fc6546d2aa7f39d4e1d/client/state/sites/selectors.js#L560) | site/utils.js - [isMainNetworkSite()](https://github.com/Automattic/wp-calypso/blob/master/client/lib/site/utils.js#L148)\r\n[siteHasMinimumJetpackVersion](https://github.com/Automattic/wp-calypso/blob/fe83917c5ddfcdc45e593fc6546d2aa7f39d4e1d/client/state/sites/selectors.js#L599) | site/jetpack.js - [hasMinimumJetpackVersion](https://github.com/Automattic/wp-calypso/blob/master/client/lib/site/jetpack.js#L33)\r\n\r\n### Testing\r\n\r\nThe best way to test these functions is running the tests paying attention to each of them since some cases has several different options to check.\r\n\r\nYou could run a specific test through of the using of --grep parameter, thus:\r\n\r\n```cli\r\n> npm run test-client client/state/sites/test/selectors.js -- --grep 'siteCanUpdateFiles'\r\n```\r\n\r\n```cli\r\n> npm run test-client client/state/sites/test/selectors.js -- --grep 'isMainNetworkSite'\r\n```\r\n```cli\r\n> npm run test-client client/state/sites/test/selectors.js -- --grep 'siteHasMinimumJetpackVersion'\r\n```\r\n\r\n<img src=\"https://cloud.githubusercontent.com/assets/77539/18841677/79b9eb12-83e0-11e6-82b4-cc4d27e7fceb.png\" width=\"600px\" />\r\n\r\ncc @enej @johnHackworth \r\n","created_at":"2016-09-26T16:01:25Z","updated_at":"2016-09-28T15:55:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8dc3bb1eb7a5b760ca437b1585494f5b682d031a","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/Automattic/wp-calypso/milestones/128","html_url":"https://github.com/Automattic/wp-calypso/milestones/Jetpack%20Plugin%20Updates%20Trashpickup","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones/128/labels","id":2011371,"number":128,"title":"Jetpack Plugin Updates Trashpickup","description":"Spending some time to clean up the /plugins section with an eye for streamlining the flows around upgrading plugins","creator":{"login":"rickybanister","id":437258,"avatar_url":"https://avatars.githubusercontent.com/u/437258?v=3","gravatar_id":"","url":"https://api.github.com/users/rickybanister","html_url":"https://github.com/rickybanister","followers_url":"https://api.github.com/users/rickybanister/followers","following_url":"https://api.github.com/users/rickybanister/following{/other_user}","gists_url":"https://api.github.com/users/rickybanister/gists{/gist_id}","starred_url":"https://api.github.com/users/rickybanister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickybanister/subscriptions","organizations_url":"https://api.github.com/users/rickybanister/orgs","repos_url":"https://api.github.com/users/rickybanister/repos","events_url":"https://api.github.com/users/rickybanister/events{/privacy}","received_events_url":"https://api.github.com/users/rickybanister/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":5,"state":"open","created_at":"2016-09-17T22:01:01Z","updated_at":"2016-09-28T11:07:46Z","due_on":"2016-09-20T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8197/commits","review_comments_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8197/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/8197/comments","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/e71ab9f554e4f502b236cd0c9d499618fcdd2aaa","head":{"label":"Automattic:update/add-jetpack-site-selectors","ref":"update/add-jetpack-site-selectors","sha":"e71ab9f554e4f502b236cd0c9d499618fcdd2aaa","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-09-28T15:43:42Z","pushed_at":"2016-09-28T15:44:10Z","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":120244,"stargazers_count":7858,"watchers_count":7858,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":986,"mirror_url":null,"open_issues_count":1541,"forks":986,"open_issues":1541,"watchers":7858,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"8f2047f8bdd70468df60bccba14b0a09b1ec963f","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-09-28T15:43:42Z","pushed_at":"2016-09-28T15:44:10Z","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":120244,"stargazers_count":7858,"watchers_count":7858,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":986,"mirror_url":null,"open_issues_count":1541,"forks":986,"open_issues":1541,"watchers":7858,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8197"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/8197"},"issue":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/8197"},"comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/8197/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8197/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/8197/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/wp-calypso/statuses/e71ab9f554e4f502b236cd0c9d499618fcdd2aaa"}}}}
{"actor":{"display_login":"aduth"}}