New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the embed block to show no preview for smugmug embeds #12961

Merged
merged 1 commit into from Jan 23, 2019

Conversation

Projects
None yet
8 participants
@brentswisher
Copy link
Contributor

brentswisher commented Dec 17, 2018

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

edit_post_ _gutenberg_dev_ _wordpress

Types of changes

New feature (non-breaking change which adds functionality)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
Update the embed block to show no preview for smugmug embeds as they …
…use fflash and causes a js error to be thrown.
@notnownikki
Copy link
Member

notnownikki left a comment

looks good to me 🚢

@ajitbohra ajitbohra merged commit b8b7bff into WordPress:master Jan 23, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jasmussen

This comment has been minimized.

Copy link
Contributor

jasmussen commented Jan 23, 2019

❣️

@paaljoachim

This comment has been minimized.

Copy link

paaljoachim commented Feb 6, 2019

I am doing some general testing on GB version 5.0 RC-1.
I am reacting to the word sorry.

"Sorry, this embedded content cannot be previewed in the editor."
---> It feels a lot better with "Embedded content cannot be previewed in the editor."
Or "Smugmug embedded content cannot be previewed in the editor."

@jasmussen

This comment has been minimized.

Copy link
Contributor

jasmussen commented Feb 6, 2019

@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( '.' );

This comment has been minimized.

@aduth

aduth Feb 7, 2019

Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment