{"action":"created","comment":{"url":"https://api.github.com/repos/WordPress/gutenberg/pulls/comments/172881676","pull_request_review_id":101967759,"id":172881676,"diff_hunk":"@@ -110,20 +141,41 @@ function getEmbedBlockSettings( { title, icon, category = 'embed', transforms, k\n \t\t\t\tconst { url } = this.props.attributes;\n \t\t\t\tconst { setAttributes } = this.props;\n \n+\t\t\t\t// If we don't have any URL patterns, or we do and the URL doesn't match,\n+\t\t\t\t// then we should look for a block that has a matching URL pattern.\n+\t\t\t\tif ( ! patterns || ( patterns && ! matchesPatterns( url, patterns ) ) ) {\n+\t\t\t\t\tconst matchingBlock = findBlock( url );\n+\t\t\t\t\t// WordPress blocks can work on multiple sites, and so don't have patterns.\n+\t\t\t\t\tif ( 'core-embed/wordpress' !== this.props.name && 'core/embed' !== matchingBlock ) {\n+\t\t\t\t\t\t// At this point, we have discovered a more suitable block for this url, so transform it.\n+\t\t\t\t\t\tif ( this.props.name !== matchingBlock ) {\n+\t\t\t\t\t\t\tthis.props.onReplace( createBlock( matchingBlock, { url } ) );\n+\t\t\t\t\t\t\treturn;\n+\t\t\t\t\t\t}\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\n \t\t\t\tthis.setState( { error: false, fetching: true } );\n-\t\t\t\twp.apiRequest( { path: `/oembed/1.0/proxy?${ stringify( { url } ) }` } )\n+\t\t\t\twpEmbedAPI( url )\n \t\t\t\t\t.then(\n \t\t\t\t\t\t( obj ) => {\n \t\t\t\t\t\t\tif ( this.unmounting ) {\n \t\t\t\t\t\t\t\treturn;\n \t\t\t\t\t\t\t}\n-\n-\t\t\t\t\t\t\tconst { html, provider_name: providerName } = obj;","path":"blocks/library/embed/index.js","position":81,"original_position":81,"commit_id":"dedf88d1409da17e31906d978576a8cea1c80ee3","original_commit_id":"dedf88d1409da17e31906d978576a8cea1c80ee3","user":{"login":"aduth","id":1779930,"avatar_url":"https://avatars1.githubusercontent.com/u/1779930?v=4","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":"I'm confused. I thought the reason we needed to manually add all block regular expressions was because we had no means on the server to recognize the provider name. So where does this value originate?","created_at":"2018-03-07T15:35:01Z","updated_at":"2018-03-07T15:39:18Z","html_url":"https://github.com/WordPress/gutenberg/pull/5315#discussion_r172881676","pull_request_url":"https://api.github.com/repos/WordPress/gutenberg/pulls/5315","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/WordPress/gutenberg/pulls/comments/172881676"},"html":{"href":"https://github.com/WordPress/gutenberg/pull/5315#discussion_r172881676"},"pull_request":{"href":"https://api.github.com/repos/WordPress/gutenberg/pulls/5315"}}},"pull_request":{"url":"https://api.github.com/repos/WordPress/gutenberg/pulls/5315","id":172055053,"html_url":"https://github.com/WordPress/gutenberg/pull/5315","diff_url":"https://github.com/WordPress/gutenberg/pull/5315.diff","patch_url":"https://github.com/WordPress/gutenberg/pull/5315.patch","issue_url":"https://api.github.com/repos/WordPress/gutenberg/issues/5315","number":5315,"state":"open","locked":false,"title":"Transform into the correct embed block based on URL patterns","user":{"login":"notnownikki","id":3314354,"avatar_url":"https://avatars2.githubusercontent.com/u/3314354?v=4","gravatar_id":"","url":"https://api.github.com/users/notnownikki","html_url":"https://github.com/notnownikki","followers_url":"https://api.github.com/users/notnownikki/followers","following_url":"https://api.github.com/users/notnownikki/following{/other_user}","gists_url":"https://api.github.com/users/notnownikki/gists{/gist_id}","starred_url":"https://api.github.com/users/notnownikki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/notnownikki/subscriptions","organizations_url":"https://api.github.com/users/notnownikki/orgs","repos_url":"https://api.github.com/users/notnownikki/repos","events_url":"https://api.github.com/users/notnownikki/events{/privacy}","received_events_url":"https://api.github.com/users/notnownikki/received_events","type":"User","site_admin":false},"body":"## Description\r\n\r\nFirst stage in decoupling from the oEmbed metadata. This addresses provider names, and makes sure that URLs get handled by the correct embed block. This has the nice effect that we can have custom settings per embed provider, and the user won't miss out on them if they select the wrong block, or the generic embed block.\r\n\r\n## How Has This Been Tested?\r\n\r\nInsert a generic embed block. Make sure the block settings are visible. Enter a Twitter url, click embed. You should see the block settings change to reflect that it's become a Twitter block.\r\n","created_at":"2018-02-28T19:52:55Z","updated_at":"2018-03-07T15:39:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1b8413104d92401567ec6454527453f12921d6d8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/WordPress/gutenberg/pulls/5315/commits","review_comments_url":"https://api.github.com/repos/WordPress/gutenberg/pulls/5315/comments","review_comment_url":"https://api.github.com/repos/WordPress/gutenberg/pulls/comments{/number}","comments_url":"https://api.github.com/repos/WordPress/gutenberg/issues/5315/comments","statuses_url":"https://api.github.com/repos/WordPress/gutenberg/statuses/dedf88d1409da17e31906d978576a8cea1c80ee3","head":{"label":"WordPress:update/embed-switch-to-correct-embed-block","ref":"update/embed-switch-to-correct-embed-block","sha":"dedf88d1409da17e31906d978576a8cea1c80ee3","user":{"login":"WordPress","id":276006,"avatar_url":"https://avatars0.githubusercontent.com/u/276006?v=4","gravatar_id":"","url":"https://api.github.com/users/WordPress","html_url":"https://github.com/WordPress","followers_url":"https://api.github.com/users/WordPress/followers","following_url":"https://api.github.com/users/WordPress/following{/other_user}","gists_url":"https://api.github.com/users/WordPress/gists{/gist_id}","starred_url":"https://api.github.com/users/WordPress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WordPress/subscriptions","organizations_url":"https://api.github.com/users/WordPress/orgs","repos_url":"https://api.github.com/users/WordPress/repos","events_url":"https://api.github.com/users/WordPress/events{/privacy}","received_events_url":"https://api.github.com/users/WordPress/received_events","type":"Organization","site_admin":false},"repo":{"id":80862584,"name":"gutenberg","full_name":"WordPress/gutenberg","owner":{"login":"WordPress","id":276006,"avatar_url":"https://avatars0.githubusercontent.com/u/276006?v=4","gravatar_id":"","url":"https://api.github.com/users/WordPress","html_url":"https://github.com/WordPress","followers_url":"https://api.github.com/users/WordPress/followers","following_url":"https://api.github.com/users/WordPress/following{/other_user}","gists_url":"https://api.github.com/users/WordPress/gists{/gist_id}","starred_url":"https://api.github.com/users/WordPress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WordPress/subscriptions","organizations_url":"https://api.github.com/users/WordPress/orgs","repos_url":"https://api.github.com/users/WordPress/repos","events_url":"https://api.github.com/users/WordPress/events{/privacy}","received_events_url":"https://api.github.com/users/WordPress/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/WordPress/gutenberg","description":"Printing since 1440. Development hub for the editor focus in core. Beta plugin is available from the official WordPress repository.","fork":false,"url":"https://api.github.com/repos/WordPress/gutenberg","forks_url":"https://api.github.com/repos/WordPress/gutenberg/forks","keys_url":"https://api.github.com/repos/WordPress/gutenberg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WordPress/gutenberg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WordPress/gutenberg/teams","hooks_url":"https://api.github.com/repos/WordPress/gutenberg/hooks","issue_events_url":"https://api.github.com/repos/WordPress/gutenberg/issues/events{/number}","events_url":"https://api.github.com/repos/WordPress/gutenberg/events","assignees_url":"https://api.github.com/repos/WordPress/gutenberg/assignees{/user}","branches_url":"https://api.github.com/repos/WordPress/gutenberg/branches{/branch}","tags_url":"https://api.github.com/repos/WordPress/gutenberg/tags","blobs_url":"https://api.github.com/repos/WordPress/gutenberg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WordPress/gutenberg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WordPress/gutenberg/git/refs{/sha}","trees_url":"https://api.github.com/repos/WordPress/gutenberg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WordPress/gutenberg/statuses/{sha}","languages_url":"https://api.github.com/repos/WordPress/gutenberg/languages","stargazers_url":"https://api.github.com/repos/WordPress/gutenberg/stargazers","contributors_url":"https://api.github.com/repos/WordPress/gutenberg/contributors","subscribers_url":"https://api.github.com/repos/WordPress/gutenberg/subscribers","subscription_url":"https://api.github.com/repos/WordPress/gutenberg/subscription","commits_url":"https://api.github.com/repos/WordPress/gutenberg/commits{/sha}","git_commits_url":"https://api.github.com/repos/WordPress/gutenberg/git/commits{/sha}","comments_url":"https://api.github.com/repos/WordPress/gutenberg/comments{/number}","issue_comment_url":"https://api.github.com/repos/WordPress/gutenberg/issues/comments{/number}","contents_url":"https://api.github.com/repos/WordPress/gutenberg/contents/{+path}","compare_url":"https://api.github.com/repos/WordPress/gutenberg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WordPress/gutenberg/merges","archive_url":"https://api.github.com/repos/WordPress/gutenberg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WordPress/gutenberg/downloads","issues_url":"https://api.github.com/repos/WordPress/gutenberg/issues{/number}","pulls_url":"https://api.github.com/repos/WordPress/gutenberg/pulls{/number}","milestones_url":"https://api.github.com/repos/WordPress/gutenberg/milestones{/number}","notifications_url":"https://api.github.com/repos/WordPress/gutenberg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WordPress/gutenberg/labels{/name}","releases_url":"https://api.github.com/repos/WordPress/gutenberg/releases{/id}","deployments_url":"https://api.github.com/repos/WordPress/gutenberg/deployments","created_at":"2017-02-03T19:34:19Z","updated_at":"2018-03-07T15:27:28Z","pushed_at":"2018-03-07T15:02:05Z","git_url":"git://github.com/WordPress/gutenberg.git","ssh_url":"git@github.com:WordPress/gutenberg.git","clone_url":"https://github.com/WordPress/gutenberg.git","svn_url":"https://github.com/WordPress/gutenberg","homepage":"https://wordpress.org/plugins/gutenberg/ ","size":11152,"stargazers_count":2077,"watchers_count":2077,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":474,"mirror_url":null,"archived":false,"open_issues_count":776,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":474,"open_issues":776,"watchers":2077,"default_branch":"master"}},"base":{"label":"WordPress:master","ref":"master","sha":"ec79a8400eda303d048205aca0f6859e8d4c6b3f","user":{"login":"WordPress","id":276006,"avatar_url":"https://avatars0.githubusercontent.com/u/276006?v=4","gravatar_id":"","url":"https://api.github.com/users/WordPress","html_url":"https://github.com/WordPress","followers_url":"https://api.github.com/users/WordPress/followers","following_url":"https://api.github.com/users/WordPress/following{/other_user}","gists_url":"https://api.github.com/users/WordPress/gists{/gist_id}","starred_url":"https://api.github.com/users/WordPress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WordPress/subscriptions","organizations_url":"https://api.github.com/users/WordPress/orgs","repos_url":"https://api.github.com/users/WordPress/repos","events_url":"https://api.github.com/users/WordPress/events{/privacy}","received_events_url":"https://api.github.com/users/WordPress/received_events","type":"Organization","site_admin":false},"repo":{"id":80862584,"name":"gutenberg","full_name":"WordPress/gutenberg","owner":{"login":"WordPress","id":276006,"avatar_url":"https://avatars0.githubusercontent.com/u/276006?v=4","gravatar_id":"","url":"https://api.github.com/users/WordPress","html_url":"https://github.com/WordPress","followers_url":"https://api.github.com/users/WordPress/followers","following_url":"https://api.github.com/users/WordPress/following{/other_user}","gists_url":"https://api.github.com/users/WordPress/gists{/gist_id}","starred_url":"https://api.github.com/users/WordPress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WordPress/subscriptions","organizations_url":"https://api.github.com/users/WordPress/orgs","repos_url":"https://api.github.com/users/WordPress/repos","events_url":"https://api.github.com/users/WordPress/events{/privacy}","received_events_url":"https://api.github.com/users/WordPress/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/WordPress/gutenberg","description":"Printing since 1440. Development hub for the editor focus in core. Beta plugin is available from the official WordPress repository.","fork":false,"url":"https://api.github.com/repos/WordPress/gutenberg","forks_url":"https://api.github.com/repos/WordPress/gutenberg/forks","keys_url":"https://api.github.com/repos/WordPress/gutenberg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WordPress/gutenberg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WordPress/gutenberg/teams","hooks_url":"https://api.github.com/repos/WordPress/gutenberg/hooks","issue_events_url":"https://api.github.com/repos/WordPress/gutenberg/issues/events{/number}","events_url":"https://api.github.com/repos/WordPress/gutenberg/events","assignees_url":"https://api.github.com/repos/WordPress/gutenberg/assignees{/user}","branches_url":"https://api.github.com/repos/WordPress/gutenberg/branches{/branch}","tags_url":"https://api.github.com/repos/WordPress/gutenberg/tags","blobs_url":"https://api.github.com/repos/WordPress/gutenberg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WordPress/gutenberg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WordPress/gutenberg/git/refs{/sha}","trees_url":"https://api.github.com/repos/WordPress/gutenberg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WordPress/gutenberg/statuses/{sha}","languages_url":"https://api.github.com/repos/WordPress/gutenberg/languages","stargazers_url":"https://api.github.com/repos/WordPress/gutenberg/stargazers","contributors_url":"https://api.github.com/repos/WordPress/gutenberg/contributors","subscribers_url":"https://api.github.com/repos/WordPress/gutenberg/subscribers","subscription_url":"https://api.github.com/repos/WordPress/gutenberg/subscription","commits_url":"https://api.github.com/repos/WordPress/gutenberg/commits{/sha}","git_commits_url":"https://api.github.com/repos/WordPress/gutenberg/git/commits{/sha}","comments_url":"https://api.github.com/repos/WordPress/gutenberg/comments{/number}","issue_comment_url":"https://api.github.com/repos/WordPress/gutenberg/issues/comments{/number}","contents_url":"https://api.github.com/repos/WordPress/gutenberg/contents/{+path}","compare_url":"https://api.github.com/repos/WordPress/gutenberg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WordPress/gutenberg/merges","archive_url":"https://api.github.com/repos/WordPress/gutenberg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WordPress/gutenberg/downloads","issues_url":"https://api.github.com/repos/WordPress/gutenberg/issues{/number}","pulls_url":"https://api.github.com/repos/WordPress/gutenberg/pulls{/number}","milestones_url":"https://api.github.com/repos/WordPress/gutenberg/milestones{/number}","notifications_url":"https://api.github.com/repos/WordPress/gutenberg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WordPress/gutenberg/labels{/name}","releases_url":"https://api.github.com/repos/WordPress/gutenberg/releases{/id}","deployments_url":"https://api.github.com/repos/WordPress/gutenberg/deployments","created_at":"2017-02-03T19:34:19Z","updated_at":"2018-03-07T15:27:28Z","pushed_at":"2018-03-07T15:02:05Z","git_url":"git://github.com/WordPress/gutenberg.git","ssh_url":"git@github.com:WordPress/gutenberg.git","clone_url":"https://github.com/WordPress/gutenberg.git","svn_url":"https://github.com/WordPress/gutenberg","homepage":"https://wordpress.org/plugins/gutenberg/ ","size":11152,"stargazers_count":2077,"watchers_count":2077,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":474,"mirror_url":null,"archived":false,"open_issues_count":776,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":474,"open_issues":776,"watchers":2077,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/WordPress/gutenberg/pulls/5315"},"html":{"href":"https://github.com/WordPress/gutenberg/pull/5315"},"issue":{"href":"https://api.github.com/repos/WordPress/gutenberg/issues/5315"},"comments":{"href":"https://api.github.com/repos/WordPress/gutenberg/issues/5315/comments"},"review_comments":{"href":"https://api.github.com/repos/WordPress/gutenberg/pulls/5315/comments"},"review_comment":{"href":"https://api.github.com/repos/WordPress/gutenberg/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/WordPress/gutenberg/pulls/5315/commits"},"statuses":{"href":"https://api.github.com/repos/WordPress/gutenberg/statuses/dedf88d1409da17e31906d978576a8cea1c80ee3"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"aduth"}}