Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.4k stars 1.98k forks source link

Reader: Facebook Embed Block does not appear in comments #45110

Closed belcherj closed 2 years ago

belcherj commented 4 years ago

Steps to reproduce

  1. Use Facebook embed block in a comment
  2. View comment in the reader
  3. Observe it does not appear

What I expected

Facebook Embed block in comments should appear

What happened instead

Facebook Embed block does not appear

Browser / OS version

Chrome/OSX Latest

Context / Source

manual-testing

github-actions[bot] commented 3 years ago

This issue is stale because it has been 180 days with no activity. You can keep the issue open by adding a comment. If you do, please provide additional context and explain why you’d like it to remain open. You can also close the issue yourself — if you do, please add a brief explanation and apply one of relevant issue close labels.

davipontesblog commented 3 years ago

Part of the Block Audit milestone: https://github.com/Automattic/wp-calypso/milestone/320 As discussed with @4thhubbard, leaving it for future consideration.

yansern commented 3 years ago

~Technical analysis: Embed links are converted into shortcodes, and shortcodes are not parsed in notifications. I believe this issue is similar to https://github.com/Automattic/wp-calypso/issues/45208#issuecomment-844067939.~

See further explanation https://github.com/Automattic/wp-calypso/issues/45208#issuecomment-845726940 and https://github.com/Automattic/wp-calypso/issues/45110#issuecomment-870716353.

Though it feels like a duplicate, I'm keeping this issue open so we also test specifically Facebook embeds.

taggon commented 3 years ago

Hello @belcherj ! 👋 Could you give us the steps how to use Facebook embeds block in the comment? I was not able to use the block editor in comments so I manually put code like the following.

<!-- wp:embed {"url":"https:\/\/www.facebook.com\/WordPress\/posts\/10159255205527911","type":"rich","providerNameSlug":"facebook","responsive":true,"previewable":false} -->
<figure class="wp-block-embed is-type-rich is-provider-facebook wp-block-embed-facebook"><div class="wp-block-embed__wrapper">
https://www.facebook.com/WordPress/posts/10159255205527911
</div></figure>
<!-- /wp:embed -->

Did I do it correctly? :)

yansern commented 3 years ago

If my understanding is correct (well, I'm known for misdiagnosis anyway so take things with a grain of salt), the facebook url itself acts as a shortcode.

What shortcodes/facebook.php does is that it creates a div container out of these links.

And a FB script is injected during the page load, where this FB script will scan the page for these div containers, and replace them with the FB content (photos/videos/etc.).

~So this might post another challenge because this phab patch D61784-code would only insert the container without loading the FB script (since notification bodies are sent through REST API, I don't think wp_enqueue_script calls would work).~

UPDATE: I striked out the above paragraph as this was about Reader not Notifications. As for Reader, similarly, if contents were stripped and loaded via REST API, perhaps what's missing is the injection of FB script for these FB containers to transform into actual FB content.

davemart-in commented 2 years ago

Gonna close this one for now. Happy to re-open if additional customers report it or if someone wants to work on it.