{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/83929884","pull_request_review_id":4740827,"id":83929884,"diff_hunk":"@@ -12,22 +12,24 @@ import { hasCustomDomain } from 'lib/site/utils';\n \n const CustomDomainPurchaseDetail = ( { selectedSite, hasDomainCredit, translate } ) => {\n \tconst renderClaimCustomDomain = () =>\n-\t\t<PurchaseDetail\n-\t\t\ticon=\"globe\"\n-\t\t\ttitle={ translate( 'Select Your Custom Domain' ) }\n-\t\t\tdescription={\n-\t\t\t\ttranslate(\n-\t\t\t\t\t'Your plan includes a free custom domain. Replace {{em}}%(siteDomain)s{{/em}} ' +\n-\t\t\t\t\t'with a custom domain to personalize your site.',\n-\t\t\t\t\t{\n-\t\t\t\t\t\targs: { siteDomain: selectedSite.domain },\n-\t\t\t\t\t\tcomponents: { em: <em /> }\n-\t\t\t\t\t}\n-\t\t\t\t)\n-\t\t\t}\n-\t\t\tbuttonText={ translate( 'Claim your free domain' ) }\n-\t\t\thref={ `/domains/add/${ selectedSite.slug }` }\n-\t\t/>;\n+\t\tselectedSite.plan.user_is_owner","path":"client/my-sites/upgrades/checkout-thank-you/custom-domain-purchase-detail.jsx","position":20,"original_position":20,"commit_id":"365d2f69142587d4d43a93b17888bfaf3eb10ebc","original_commit_id":"365d2f69142587d4d43a93b17888bfaf3eb10ebc","user":{"login":"gwwar","id":1270189,"avatar_url":"https://avatars.githubusercontent.com/u/1270189?v=3","gravatar_id":"","url":"https://api.github.com/users/gwwar","html_url":"https://github.com/gwwar","followers_url":"https://api.github.com/users/gwwar/followers","following_url":"https://api.github.com/users/gwwar/following{/other_user}","gists_url":"https://api.github.com/users/gwwar/gists{/gist_id}","starred_url":"https://api.github.com/users/gwwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gwwar/subscriptions","organizations_url":"https://api.github.com/users/gwwar/orgs","repos_url":"https://api.github.com/users/gwwar/repos","events_url":"https://api.github.com/users/gwwar/events{/privacy}","received_events_url":"https://api.github.com/users/gwwar/received_events","type":"User","site_admin":false},"body":"> So, instead of grabbing user_is_owner out of selectedSite.plan, let's use a selector for this in the outside connected component and pass it down to the CustomDomainPurchaseDetail component.\r\n\r\n@lamosty  Seems reasonable, but let's not block the PR. How about we follow up in another Janitorial?","created_at":"2016-10-18T19:17:16Z","updated_at":"2016-10-18T19:17:16Z","html_url":"https://github.com/Automattic/wp-calypso/pull/8612#discussion_r83929884","pull_request_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8612","_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/83929884"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/8612#discussion_r83929884"},"pull_request":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8612"}}},"pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8612","id":88556297,"html_url":"https://github.com/Automattic/wp-calypso/pull/8612","diff_url":"https://github.com/Automattic/wp-calypso/pull/8612.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/8612.patch","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/8612","number":8612,"state":"open","locked":false,"title":"Plans: Removes domain claim box for non-plan owners","user":{"login":"jeremeylduvall","id":7240478,"avatar_url":"https://avatars.githubusercontent.com/u/7240478?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremeylduvall","html_url":"https://github.com/jeremeylduvall","followers_url":"https://api.github.com/users/jeremeylduvall/followers","following_url":"https://api.github.com/users/jeremeylduvall/following{/other_user}","gists_url":"https://api.github.com/users/jeremeylduvall/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremeylduvall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremeylduvall/subscriptions","organizations_url":"https://api.github.com/users/jeremeylduvall/orgs","repos_url":"https://api.github.com/users/jeremeylduvall/repos","events_url":"https://api.github.com/users/jeremeylduvall/events{/privacy}","received_events_url":"https://api.github.com/users/jeremeylduvall/received_events","type":"User","site_admin":false},"body":"As described in #8442, we should only display the Claim Domain box on the My Plan page when the user is also the owner of the corresponding plan. Otherwise, we shouldn't show the box. However, non-plan owners can still manage the domains on a site at the admin user role so we _should_ display the Manage Domain box in those cases.\r\n\r\nFour cases to consider:\r\n\r\nSite has a domain credit available:\r\n- Owner should see claim domain panel\r\n- Other users (including admins) should not see the panel\r\n\r\nSite is currently using domain credit:\r\n- Owner should see manage option\r\n- Admins should see manage option\r\n\r\nTo accomplish this, I added a ternary to `renderClaimCustomDomain` that checks for `selectedSite.plan.user_is_owner`. If it returns `true`, the claim box is displayed. Otherwise, it returns `null`. A more complex option would be to turn this into a site capability and [use `userCan`](https://github.com/Automattic/wp-calypso/blob/fcf789ebb43b7d8fe9a912d8fa82d5bee66573b5/client/lib/site/utils.js#L9). I think this simpler solution works though.\r\n\r\n## To test\r\n1. Load this branch and visit http://calypso.localhost:3000/plans/my-plan/ for a site with a plan. You'll want to open two separate tabs—one as the plan owner and another as an admin but not bundle owner.\r\n2. Make sure the domain credit on your plan is being used. Check to make sure you see the manage domain option on both pages.\r\n3. Empty the domain credit on your bundle so you have a fresh credit available. Reload the my-plan page. Confirm that you only see the claim domain box as the plan owner.\r\n\r\n## Screenshots\r\n\r\n**Owners and non-owners with credit being used**\r\n\r\n![screen shot 2016-10-08 at 12 59 17 pm](https://cloud.githubusercontent.com/assets/7240478/19215403/4d4fb2e0-8d5a-11e6-8213-6498e0868278.png)\r\n\r\n**Owners with free domain credit**\r\n\r\n![screen shot 2016-10-08 at 1 01 37 pm](https://cloud.githubusercontent.com/assets/7240478/19215405/62d7c1de-8d5a-11e6-82d7-55113ceb5fc3.png)\r\n\r\n**Admins with free domain credit**\r\n\r\n![screen shot 2016-10-08 at 1 01 28 pm](https://cloud.githubusercontent.com/assets/7240478/19215407/67bb9cac-8d5a-11e6-9393-62c8b0b1f809.png)\r\n","created_at":"2016-10-08T19:24:41Z","updated_at":"2016-10-18T19:17:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44fd46886bf75cda0152ee2a9a850e4cd682b87f","assignee":{"login":"jeremeylduvall","id":7240478,"avatar_url":"https://avatars.githubusercontent.com/u/7240478?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremeylduvall","html_url":"https://github.com/jeremeylduvall","followers_url":"https://api.github.com/users/jeremeylduvall/followers","following_url":"https://api.github.com/users/jeremeylduvall/following{/other_user}","gists_url":"https://api.github.com/users/jeremeylduvall/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremeylduvall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremeylduvall/subscriptions","organizations_url":"https://api.github.com/users/jeremeylduvall/orgs","repos_url":"https://api.github.com/users/jeremeylduvall/repos","events_url":"https://api.github.com/users/jeremeylduvall/events{/privacy}","received_events_url":"https://api.github.com/users/jeremeylduvall/received_events","type":"User","site_admin":false},"assignees":[{"login":"jeremeylduvall","id":7240478,"avatar_url":"https://avatars.githubusercontent.com/u/7240478?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremeylduvall","html_url":"https://github.com/jeremeylduvall","followers_url":"https://api.github.com/users/jeremeylduvall/followers","following_url":"https://api.github.com/users/jeremeylduvall/following{/other_user}","gists_url":"https://api.github.com/users/jeremeylduvall/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremeylduvall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremeylduvall/subscriptions","organizations_url":"https://api.github.com/users/jeremeylduvall/orgs","repos_url":"https://api.github.com/users/jeremeylduvall/repos","events_url":"https://api.github.com/users/jeremeylduvall/events{/privacy}","received_events_url":"https://api.github.com/users/jeremeylduvall/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8612/commits","review_comments_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8612/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/8612/comments","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/365d2f69142587d4d43a93b17888bfaf3eb10ebc","head":{"label":"Automattic:fix/8422-register-domain-box","ref":"fix/8422-register-domain-box","sha":"365d2f69142587d4d43a93b17888bfaf3eb10ebc","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-10-18T17:01:04Z","pushed_at":"2016-10-18T19:16:01Z","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":113045,"stargazers_count":7917,"watchers_count":7917,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":996,"mirror_url":null,"open_issues_count":1477,"forks":996,"open_issues":1477,"watchers":7917,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"f1e1636ba79963785e7ed5d83c7fecd1185b1b8d","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-10-18T17:01:04Z","pushed_at":"2016-10-18T19:16:01Z","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":113045,"stargazers_count":7917,"watchers_count":7917,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":996,"mirror_url":null,"open_issues_count":1477,"forks":996,"open_issues":1477,"watchers":7917,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8612"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/8612"},"issue":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/8612"},"comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/8612/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8612/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/8612/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/wp-calypso/statuses/365d2f69142587d4d43a93b17888bfaf3eb10ebc"}}}}
{"actor":{"display_login":"gwwar"}}