Wp-calypso: Notifications: Shortcode blocks are not parsed.

Created on 26 Aug 2020  路  4Comments  路  Source: Automattic/wp-calypso

Steps to reproduce

  1. Starting at URL: https://wordpress.com/read
  2. Open Notifications and locate a notification from a post that includes a Shortcode Block which contains a YouTube shortcode
  3. Click to open it and reveal the secondary side pane and notice the raw shortcode
  4. Open Notifications again and locate a notification from a post comment that includes a Shortcode Block which contains a YouTube shortcode
  5. Click to open it and reveal the secondary side pane and notice the raw shortcode

What I expected

I expected to see the YouTube video itself in both the above scenarios. Perhaps a something instead of the video, like a YouTube icon or similar could also work.

What happened instead

Notice that the side panel doesn't display the YouTube video itself, you only see the shortcode itself (e.g. [youtube https://www.youtube.com/watch?v=fX8YLri4wxU])

| Scenario | Screenshot |
| - | - |
| Post notification 鈿狅笍 | Screenshot of post notification showing raw shortcode instead of actual YouTube video |
| Post comment notification 鈿狅笍 | Screenshot of post comment notification showing raw shortcode instead of actual YouTube video |

Browser / OS version

Firefox 79.0

Screenshot / Video

See above

Blocks Notifications [Type] Bug

All 4 comments

Hi folks!

Would this issue also cover the rendering in the notification emails?

We got a report from a user ( 3304752-zd-woothemes ) about YouTube videos no longer rendering in the email notifications:

Before:

Markup on 2020-09-25 at 08:20:56

Blog post from the screenshot

After:

Markup on 2020-09-25 at 08:20:25

Blog post from the screenshot

Please, let me know if you need me to create a new issue for this :)

馃憢 Hi @AtrumGeost, I think that this issue belongs on a separate (internal) repo, I'll DM you the link.

This applies to all shortcode blocks; updated the issue title.

I wonder if this can be fixed by running do_shortcode when getting the post content in Notification_Builder::add_post_block:

$post_content = do_blocks( $post->post_content );
$post_content = do_shortcode( post_content );
$post_content = apply_filters( 'the_content', $post_content );
Was this page helpful?
0 / 5 - 0 ratings