{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/wp-calypso/issues/14928","repository_url":"https://api.github.com/repos/Automattic/wp-calypso","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/14928/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/14928/comments","events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/14928/events","html_url":"https://github.com/Automattic/wp-calypso/pull/14928","id":234599311,"number":14928,"title":"Revisions #5: Add support for `page` postTypes","user":{"login":"bperson","id":1145270,"avatar_url":"https://avatars3.githubusercontent.com/u/1145270?v=3","gravatar_id":"","url":"https://api.github.com/users/bperson","html_url":"https://github.com/bperson","followers_url":"https://api.github.com/users/bperson/followers","following_url":"https://api.github.com/users/bperson/following{/other_user}","gists_url":"https://api.github.com/users/bperson/gists{/gist_id}","starred_url":"https://api.github.com/users/bperson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bperson/subscriptions","organizations_url":"https://api.github.com/users/bperson/orgs","repos_url":"https://api.github.com/users/bperson/repos","events_url":"https://api.github.com/users/bperson/events{/privacy}","received_events_url":"https://api.github.com/users/bperson/received_events","type":"User","site_admin":false},"labels":[{"id":301697869,"url":"https://api.github.com/repos/Automattic/wp-calypso/labels/OSS%20Citizen","name":"OSS Citizen","color":"5319e7","default":false},{"id":542899089,"url":"https://api.github.com/repos/Automattic/wp-calypso/labels/[Size]%20M","name":"[Size] M","color":"8d478a","default":false},{"id":285010018,"url":"https://api.github.com/repos/Automattic/wp-calypso/labels/[Status]%20Needs%20Review","name":"[Status] Needs Review","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-08T17:24:12Z","updated_at":"2017-06-13T15:10:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/14928","html_url":"https://github.com/Automattic/wp-calypso/pull/14928","diff_url":"https://github.com/Automattic/wp-calypso/pull/14928.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/14928.patch"},"body":"**Note: This builds on top of #14927 and #14943 (fix for the CI build failure), so it's not merge-able yet**\r\n\r\n5th chunk coming from my WIP PR to introduce post revisions in calypso: #13367. This simply adds support for pages. It's mostly code to hit a different endpoint based on the `postType`.\r\n\r\n### testing\r\n\r\n* The unit tests for the data-layer part have been updated to test this use case as well\r\n* Manual testing: Tap on \"x revisions\" in the post editor sidebar of a page (shown only on pages with multiple revisions)\r\n"},"comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments/308148342","html_url":"https://github.com/Automattic/wp-calypso/pull/14928#issuecomment-308148342","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/14928","id":308148342,"user":{"login":"bperson","id":1145270,"avatar_url":"https://avatars3.githubusercontent.com/u/1145270?v=3","gravatar_id":"","url":"https://api.github.com/users/bperson","html_url":"https://github.com/bperson","followers_url":"https://api.github.com/users/bperson/followers","following_url":"https://api.github.com/users/bperson/following{/other_user}","gists_url":"https://api.github.com/users/bperson/gists{/gist_id}","starred_url":"https://api.github.com/users/bperson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bperson/subscriptions","organizations_url":"https://api.github.com/users/bperson/orgs","repos_url":"https://api.github.com/users/bperson/repos","events_url":"https://api.github.com/users/bperson/events{/privacy}","received_events_url":"https://api.github.com/users/bperson/received_events","type":"User","site_admin":false},"created_at":"2017-06-13T15:10:27Z","updated_at":"2017-06-13T15:10:27Z","body":"> Does the revisions endpoint not support custom post types? Ideally we'd not be tied to posts and pages only.\r\n\r\nit looks like there is support for some post types.\r\n\r\n> Would GET /sites/%s/posts/%d/revisions return anything if the ID passed was one for a custom post type?\r\n\r\nNope, but it does work (for some post types) if you use the normalised post type resource name [0]: `/sites/%s/<normalised post type>/%d/revisions`. For instance, it works with `jetpack-testimonial` but not with `media` (it's the normalised post type resource name for the `attachment` post type).\r\n\r\n[0] I can't find logic in calypso that would do what's done [in the REST API](https://github.com/WordPress/WordPress/blob/master/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php#L60) to compute the resource name though: \r\n\r\n`$this->parent_base = ! empty( $post_type_object->rest_base ) ? $post_type_object->rest_base : $post_type_object->name;`\r\n\r\nThe issue comes from the fact we populate `postTypes` in Redux from old endpoints which won't return `rest_base` which is used to compute the resource name.\r\n\r\nI ideally would like to not upgrade the code fetching post types to v2, as it sounds like a deep rabbit hole, so there are 2 options I think:\r\n1- disable the revisions UI for custom post types\r\n2- play it risky: `const resourceName = get( { page: pages, post: posts }, postType, postType )`\r\n"}}
{"actor":{"display_login":"bperson"}}