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

Generates excerpt using core get_the_excerpt #19669

Merged
merged 3 commits into from Feb 4, 2020

Conversation

@draganescu
Copy link
Contributor

draganescu commented Jan 15, 2020

Description

Closes #19418

How has this been tested?

Tested locally in browser by making some posts with embedded tweets and then another using the latest posts block.

The way to test:

  • make a post or more with some tweet embeds and some text.
  • mare sure the embed is close to the start of the post.
  • make a post and use the latest posts block
  • set the block to show excerpt
  • there should be no tweet links in the excerpt

Types of changes

The latest posts block does, I believe, two wrong things about the excerpt:

  • in the server side renderer it uses a custom way to get the excerpt which bypasses the core function that among other things renders only allowed blocks, strips shortcodes and a lot more.
  • in the client side renderer it gets the rendered excerpt and then wrongfully checks for the raw excerpt, which may be empty if post has no manual excerpt, resetting the rendered excerpt with the raw post content.

This is what this PR fixes.

…in client side editor rendering
@talldan

This comment has been minimized.

Copy link
Contributor

talldan commented Jan 24, 2020

@draganescu Would you be able to provide some testing instructions, what should I look out for when testing?

I might be doing something wrong, but I still see the tweet URL in the latest posts block:
Screen Shot 2020-01-24 at 12 54 03 pm

@draganescu

This comment has been minimized.

Copy link
Contributor Author

draganescu commented Jan 24, 2020

hey @talldan thanks for trying this out:

The way to test:

  • make a post or more with some tweet embeds and some text.
  • mare sure the embed is close to the start of the post.
  • make a post and use the latest posts block
  • set the block to show excerpt
  • there should be no tweet links in the excerpt

Do not use the full content option, that is a different issue I think.

@draganescu

This comment has been minimized.

Copy link
Contributor Author

draganescu commented Jan 24, 2020

So @talldan the problem you encountered is that in the Latest Posts block there was a fallback which used the full post in case there was an empty excerpt. Now, I am not sure this fallback is the best option.

If I select excerpt, and the excerpt:

  • either shows the excerpt
  • or makes one from the post itself

... then there is no reason for the fallback.

The filtering of blocks from content does not apply (and shouldn't) for full post content.

Can you retest? Should be OK now.

Copy link
Member

ajitbohra left a comment

Works as expected, code-wise LGTM 👍

@draganescu draganescu merged commit 6fc88ca into master Feb 4, 2020
1 check passed
1 check passed
Travis CI - Pull Request Build Passed
Details
@draganescu draganescu deleted the fix/no-embeds-in-latest-posts-excerpts branch Feb 4, 2020
@github-actions github-actions bot added this to the Gutenberg 7.5 milestone Feb 4, 2020
chipsnyder added a commit that referenced this pull request Feb 7, 2020
* generates exerpt using core get_the_excerpt; fixes excerpt raw logic in client side editor rendering

* removes unused variable

* removes the fall back on post content in case excerpt is empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.