Skip to content
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

Eventbrite Block: No error message with invalid urls #14507

Closed
creativecoder opened this issue Jan 29, 2020 · 6 comments · Fixed by #21247
Closed

Eventbrite Block: No error message with invalid urls #14507

creativecoder opened this issue Jan 29, 2020 · 6 comments · Fixed by #21247
Assignees
Labels
[Block] Eventbrite [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Pri] Normal [Size] S [Type] Bug When a feature is broken and / or not performing as intended

Comments

@creativecoder
Copy link
Contributor

creativecoder commented Jan 29, 2020

Steps to reproduce the issue

  1. Add the Eventbrite block in a post or page
  2. For the event url, use something that won't embed, like https://eventbrite.com

What I expected

An error message and option to "Convert block to link" below the event url

What happened instead

No error message

Screenshots

Eventbrite block no error

@creativecoder
Copy link
Contributor Author

Looks like the layout issue is fixed in Gutenberg, but not yet released WordPress/gutenberg#19673

We still need to add the outline to the Embed and Convert block to link buttons here, though.

@jeherve jeherve added [Block] Eventbrite [Type] Bug When a feature is broken and / or not performing as intended [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack labels Jan 29, 2020
@jeherve
Copy link
Member

jeherve commented Jan 29, 2020

Since this also impacts core embeds, I would be tempted to wait until the fix makes it to a stable version of Gutenberg soon.

We still need to add the outline to the Embed and Convert block to link buttons here, though.

Does this mean switching to a different button style (secondary)?

@stale
Copy link

stale bot commented Jul 27, 2020

This issue has been marked as stale. This happened because:

  • It has been inactive in the past 6 months.
  • It hasn’t been labeled `[Pri] Blocker`, `[Pri] High`.

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

@stale stale bot added the [Status] Stale label Jul 27, 2020
@creativecoder creativecoder changed the title Eventbrite Block: Placeholder layout broken with the latest version of Gutenberg Eventbrite Block: No error message with invalid urls Jul 28, 2020
@creativecoder
Copy link
Contributor Author

Looks like there's now no error message showing for the Eventbrite block with invalid urls. I've updated the issue title and description.

@ivan-ottinger
Copy link
Contributor

I have tested the issue and it looks like that the setErrorNotice():

setErrorNotice = () => {
const { noticeOperations, onReplace } = this.props;
const { editedUrl } = this.state;
noticeOperations.removeAllNotices();
noticeOperations.createErrorNotice(
<>
{ __( 'Sorry, this content could not be embedded.', 'jetpack' ) }{ ' ' }
<Button isLink onClick={ () => convertToLink( editedUrl, onReplace ) }>
{ _x( 'Convert block to link', 'button label', 'jetpack' ) }
</Button>
</>
);
};

is called only when the testEmbedUrl promise fails:

.catch( () => {
setAttributes( { eventId: undefined, url: undefined } );
this.setErrorNotice();
} );

But this depends on the responseStatusCode (in test-embed-url.js):

return new Promise( ( resolve, reject ) => {
apiFetch( { path: `/wpcom/v2/resolve-redirect/?url=${ encodeURIComponent( url ) }` } ).then(
response => {
setIsResolvingUrl( false );
const responseStatusCode = response.status ? parseInt( response.status, 10 ) : null;
if ( responseStatusCode && responseStatusCode >= 400 ) {
reject();
} else {
resolve( response.url || url );
}
},
() => {
setIsResolvingUrl( false );
reject();
}
);
} );

and therefore only "really invalid" URLs, e.g. https://www.testtestevenbrite.com/ will display the error message. All other URLs, e.g. https://google.com won't return any error message.

@alshakero
Copy link
Member

PR ready #21247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Eventbrite [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Pri] Normal [Size] S [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants