Update the embed block to show no preview for smugmug embeds#12961
Update the embed block to show no preview for smugmug embeds#12961ajitbohra merged 1 commit intoWordPress:masterfrom
Conversation
…use fflash and causes a js error to be thrown.
|
❣️ |
|
I am doing some general testing on GB version 5.0 RC-1. "Sorry, this embedded content cannot be previewed in the editor." |
|
@paaljoachim Good point. Feel free to create a new ticket, you can ping me if you'd like it categorized well. I imagine such a change would be ripe territory for "Good First Ticket" labels. |
| const parsedUrl = parse( url ); | ||
| const cannotPreview = includes( HOSTS_NO_PREVIEWS, parsedUrl.host.replace( /^www\./, '' ) ); | ||
| const parsedHost = parse( url ).host.split( '.' ); | ||
| const parsedHostBaseUrl = parsedHost.splice( parsedHost.length - 2, parsedHost.length - 1 ).join( '.' ); |
There was a problem hiding this comment.
It's very non-obvious to me as a future maintainer what it is we're trying to accomplish here with this logic. It would have been very helpful to include one or more of an inline code comment, separate named and documented function, and unit test.
Description
Fixes #11960 by adding smugmug.com to the array of domains that the "no-preview" screen is shown. Also adjusted the matching criteria to grab the base domain instead of just stripping "www." off of the host if found. This was necessary as smugmug embeds are in the format "username.smugmug.com"
How has this been tested?
Manually tested to verify that both individual photos and galleries display the no preview message using:
https://johndavis.smugmug.com/Nature/Landscape/i-NntLPZ8
https://johndavis.smugmug.com/Nature/Landscape
Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: