{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/84765504","pull_request_review_id":5518649,"id":84765504,"diff_hunk":"@@ -141,68 +196,50 @@ class TermFormDialog extends Component {\n \t\treturn ! error;\n \t}\n \n-\tvalidateInput( event ) {\n-\t\tif ( 13 === event.keyCode ) {\n-\t\t\tthis.saveTerm();\n-\t\t} else {\n-\t\t\tthis.isValid();\n-\t\t}\n-\t}\n-\n-\tsaveTerm() {\n-\t\tconst term = this.getFormValues();\n-\t\tif ( ! this.isValid() ) {\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tconst { siteId, taxonomy } = this.props;\n-\n-\t\tthis.props\n-\t\t\t.addTerm( siteId, taxonomy, term )\n-\t\t\t.then( this.props.onSuccess );\n-\t\tthis.closeDialog();\n-\t}\n-\n \trenderParentSelector() {\n \t\tconst { labels, siteId, taxonomy, translate } = this.props;\n \t\tconst { searchTerm, selectedParent } = this.state;\n \t\tconst query = {};\n \t\tif ( searchTerm && searchTerm.length ) {\n \t\t\tquery.search = searchTerm;\n \t\t}\n+\t\tconst hideTermAndChildren = get( this.props.term, 'ID' );\n \n \t\treturn (\n \t\t\t<FormFieldset>\n \t\t\t\t<FormLegend>\n \t\t\t\t\t{ labels.parent_item }\n \t\t\t\t</FormLegend>\n \t\t\t\t<FormLabel>\n-\t\t\t\t\t<FormCheckbox ref=\"topLevel\" checked={ this.state.isTopLevel } onChange={ this.boundOnTopLevelChange } />\n+\t\t\t\t\t<FormCheckbox ref=\"topLevel\" checked={ this.state.isTopLevel } onChange={ this.onTopLevelChange } />\n \t\t\t\t\t<span>{ translate( 'Top level', { context: 'Terms: New term being created is top level' } ) }</span>\n \t\t\t\t</FormLabel>\n \t\t\t\t<TermTreeSelectorTerms\n \t\t\t\t\tsiteId={ siteId }\n \t\t\t\t\ttaxonomy={ taxonomy }\n-\t\t\t\t\tonSearch={ this.boundOnSearch }\n-\t\t\t\t\tonChange={ this.boundOnParentChange }\n+\t\t\t\t\tonSearch={ this.onSearch }\n+\t\t\t\t\tonChange={ this.onParentChange }\n \t\t\t\t\tquery={ query }\n \t\t\t\t\tselected={ selectedParent }\n+\t\t\t\t\thideTermAndChildren={ hideTermAndChildren }\n \t\t\t\t/>\n \t\t\t</FormFieldset>\n \t\t);\n \t}\n \n \trender() {\n \t\tconst { isHierarchical, labels, translate, showDescriptionInput, showDialog } = this.props;\n+\t\tconst { name, description } = this.state;\n+\t\tconst isNew = ! this.props.term;","path":"client/blocks/term-form-dialog/index.jsx","position":247,"original_position":247,"commit_id":"a3fb1d6826febe2ab251f4d2e4a088f18fb96559","original_commit_id":"a3fb1d6826febe2ab251f4d2e4a088f18fb96559","user":{"login":"timmyc","id":22080,"avatar_url":"https://avatars.githubusercontent.com/u/22080?v=3","gravatar_id":"","url":"https://api.github.com/users/timmyc","html_url":"https://github.com/timmyc","followers_url":"https://api.github.com/users/timmyc/followers","following_url":"https://api.github.com/users/timmyc/following{/other_user}","gists_url":"https://api.github.com/users/timmyc/gists{/gist_id}","starred_url":"https://api.github.com/users/timmyc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timmyc/subscriptions","organizations_url":"https://api.github.com/users/timmyc/orgs","repos_url":"https://api.github.com/users/timmyc/repos","events_url":"https://api.github.com/users/timmyc/events{/privacy}","received_events_url":"https://api.github.com/users/timmyc/received_events","type":"User","site_admin":false},"body":"minor but should we just assign `terms` in line 231 too?","created_at":"2016-10-24T19:33:42Z","updated_at":"2016-10-24T19:34:21Z","html_url":"https://github.com/Automattic/wp-calypso/pull/8806#discussion_r84765504","pull_request_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8806","_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/84765504"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/8806#discussion_r84765504"},"pull_request":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8806"}}},"pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8806","id":89798937,"html_url":"https://github.com/Automattic/wp-calypso/pull/8806","diff_url":"https://github.com/Automattic/wp-calypso/pull/8806.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/8806.patch","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/8806","number":8806,"state":"open","locked":false,"title":"Taxonomies: Refactor the FormTermDialog Component to allow editing","user":{"login":"youknowriad","id":272444,"avatar_url":"https://avatars.githubusercontent.com/u/272444?v=3","gravatar_id":"","url":"https://api.github.com/users/youknowriad","html_url":"https://github.com/youknowriad","followers_url":"https://api.github.com/users/youknowriad/followers","following_url":"https://api.github.com/users/youknowriad/following{/other_user}","gists_url":"https://api.github.com/users/youknowriad/gists{/gist_id}","starred_url":"https://api.github.com/users/youknowriad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youknowriad/subscriptions","organizations_url":"https://api.github.com/users/youknowriad/orgs","repos_url":"https://api.github.com/users/youknowriad/repos","events_url":"https://api.github.com/users/youknowriad/events{/privacy}","received_events_url":"https://api.github.com/users/youknowriad/received_events","type":"User","site_admin":false},"body":" * If we provide a `term` prop, the dialog shows an edit form\r\n * Editing a term, drops and creates a new term (API behavior)\r\n * Update posts after term update\r\n\r\n**Technical aspects**\r\n\r\nWhen we trigger the update API call, the API returns a new term (new ID and new Slug), attaches this term with the current site and drops the old term from the current site. The API also updates the post <-> terms relationship. \r\n\r\nSo these changes need to be reflected on the Redux state as well. I tried to keep it simple for now and I handled those directly on the Action Creator (side effects goes there right :) ). I'm not sure if this kind of behavior (updating an entity triggers replacement of the entity and updating other related entities) is common or if it's only related to terms. If this is common on the API, we may have to think of a more advanced mechanism (similar to QueryManagers ?) to reflect changes between different entities.\r\n\r\ncloses #8584\r\n\r\n**Testing instructions**\r\n\r\nFor now the edit form is not used anywhere on Calypso (next PR), so just make sure adding categories to posts from the Editor, works as expected.\r\n\r\ncc @aduth @timmyc ","created_at":"2016-10-18T11:48:12Z","updated_at":"2016-10-24T19:34:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e77c39dcc1e05a7cef0f0275f3e2b0e22f4b989a","assignee":{"login":"youknowriad","id":272444,"avatar_url":"https://avatars.githubusercontent.com/u/272444?v=3","gravatar_id":"","url":"https://api.github.com/users/youknowriad","html_url":"https://github.com/youknowriad","followers_url":"https://api.github.com/users/youknowriad/followers","following_url":"https://api.github.com/users/youknowriad/following{/other_user}","gists_url":"https://api.github.com/users/youknowriad/gists{/gist_id}","starred_url":"https://api.github.com/users/youknowriad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youknowriad/subscriptions","organizations_url":"https://api.github.com/users/youknowriad/orgs","repos_url":"https://api.github.com/users/youknowriad/repos","events_url":"https://api.github.com/users/youknowriad/events{/privacy}","received_events_url":"https://api.github.com/users/youknowriad/received_events","type":"User","site_admin":false},"assignees":[{"login":"youknowriad","id":272444,"avatar_url":"https://avatars.githubusercontent.com/u/272444?v=3","gravatar_id":"","url":"https://api.github.com/users/youknowriad","html_url":"https://github.com/youknowriad","followers_url":"https://api.github.com/users/youknowriad/followers","following_url":"https://api.github.com/users/youknowriad/following{/other_user}","gists_url":"https://api.github.com/users/youknowriad/gists{/gist_id}","starred_url":"https://api.github.com/users/youknowriad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youknowriad/subscriptions","organizations_url":"https://api.github.com/users/youknowriad/orgs","repos_url":"https://api.github.com/users/youknowriad/repos","events_url":"https://api.github.com/users/youknowriad/events{/privacy}","received_events_url":"https://api.github.com/users/youknowriad/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8806/commits","review_comments_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8806/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/8806/comments","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/a3fb1d6826febe2ab251f4d2e4a088f18fb96559","head":{"label":"Automattic:update/edit-form-term-dialog","ref":"update/edit-form-term-dialog","sha":"a3fb1d6826febe2ab251f4d2e4a088f18fb96559","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-24T12:57:45Z","pushed_at":"2016-10-24T19:34:03Z","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":145114,"stargazers_count":7941,"watchers_count":7941,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":998,"mirror_url":null,"open_issues_count":1486,"forks":998,"open_issues":1486,"watchers":7941,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"6f690ff5dbf9f6b675725dc18c9b91e739412afd","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-24T12:57:45Z","pushed_at":"2016-10-24T19:34:03Z","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":145114,"stargazers_count":7941,"watchers_count":7941,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":998,"mirror_url":null,"open_issues_count":1486,"forks":998,"open_issues":1486,"watchers":7941,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8806"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/8806"},"issue":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/8806"},"comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/8806/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/8806/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/8806/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/wp-calypso/statuses/a3fb1d6826febe2ab251f4d2e4a088f18fb96559"}}}}
{"actor":{"display_login":"timmyc"}}