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

Adding support for up to 6 related posts #11220

Merged
merged 10 commits into from
Feb 12, 2019

Conversation

roccotripaldi
Copy link
Member

Works with Automattic/wp-calypso#30224 to allow up to six related posts items.

Fixes #11014

Changes proposed in this Pull Request:

Testing instructions:

Run this on both a site that has less than 10 posts as well as a site that has more than 10 posts.

Proposed changelog entry for your changes:

  • The Related Posts block will now show up to 6 posts.

@matticbot
Copy link
Contributor

D23611-code. (newly created revision)

@jetpackbot
Copy link

jetpackbot commented Jan 29, 2019

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

Scheduled Jetpack release: March 5, 2019.
Scheduled code freeze: February 26, 2019

Generated by 🚫 dangerJS against 06ee6d8

@aldavigdis
Copy link
Contributor

Is this generated via some sort of a linting process or something?

I see a lot of spaces being used instead of tabs. :\

@roccotripaldi roccotripaldi added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] In Progress labels Feb 1, 2019
@roccotripaldi roccotripaldi changed the title Adding support for up to 6 related posts [WIP] Adding support for up to 6 related posts Feb 1, 2019
aldavigdis
aldavigdis previously approved these changes Feb 1, 2019
Copy link
Contributor

@aldavigdis aldavigdis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say we have gone through every bit of code here and I have no objections myself.

@jeherve jeherve added the [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack label Feb 4, 2019
@dereksmart dereksmart added the [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it label Feb 5, 2019
@matticbot
Copy link
Contributor

roccotripaldi, Your synced wpcom patch D23611-code has been updated.

<?php
$html = ob_get_clean();

remove_filter( 'the_content', 'wpautop' );
Copy link
Contributor

@lezama lezama Feb 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure about the consequences of this change.
Could we achieve the same result by hiding <p>s via css.
or as @enejb suggested maybe replacing new lines from $html after $html = ob_get_clean();?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can modify this a bit — or simply remove it in anticipation for https://core.trac.wordpress.org/ticket/45495 being closed in time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you provide a bit of background on this change? Is this already an issue with the current version of the Related Posts block? If yes, how can I reproduce the problem? If not, what changed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internal discussion: pafL3P-jr-p2

@matticbot
Copy link
Contributor

roccotripaldi, Your synced wpcom patch D23611-code has been updated.

jeherve
jeherve previously approved these changes Feb 12, 2019
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work well for me in my tests. It should be good to merge.

Just a quick, non-blocking note: in the editor as well as on the frontend, should we crop images so they always fit on a grid, just like we do for the regular related posts? This would avoid posts being unaligned like so:
image

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. [Status] Ready to Merge Go ahead, you can push that green button! labels Feb 12, 2019
@jeherve
Copy link
Member

jeherve commented Feb 12, 2019

This will need a rebase first, though, to incorporate the recent changes to block registration (notably #11310).

@aldavigdis
Copy link
Contributor

@jeherve It seems like videos are an exception here. But it may be a good idea to create a separate issue ticket to solve that.

One other issue that I see is that images that have not been processed correctly on wordpress.com due to the connection being bad (example: https://i0.wp.com/alda8c.pagekite.me/wp-content/uploads/2019/02/vector__527___fluttershy__28_by_dashiesparkle-daashsq.png?resize=350%2C200&ssl=1) are also squares.

I'm going to rebase this one to master and merge if all goes well.

@aldavigdis aldavigdis force-pushed the related-posts-allow-more-posts-11014 branch from 1b08c27 to 06ee6d8 Compare February 12, 2019 13:11
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Feb 12, 2019
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving once again, post rebase.

@aldavigdis aldavigdis merged commit 4725246 into master Feb 12, 2019
@ghost ghost removed the [Status] Ready to Merge Go ahead, you can push that green button! label Feb 12, 2019
@aldavigdis aldavigdis deleted the related-posts-allow-more-posts-11014 branch February 12, 2019 16:13
@dereksmart dereksmart restored the related-posts-allow-more-posts-11014 branch February 12, 2019 17:13
@dereksmart dereksmart deleted the related-posts-allow-more-posts-11014 branch February 12, 2019 17:13
jeherve added a commit that referenced this pull request Feb 22, 2019
@@ -769,7 +769,7 @@ public function get_for_post_id( $post_id, array $args ) {
$options['size'] = $args['size'];
}

if ( ! $options['enabled'] || 0 == (int)$post_id || empty( $options['size'] ) || get_post_status( $post_id) !== 'publish' ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aldavigdis Could you tell me more about removing the enabled check? This is causing a regression in that we have a filter so folks can selectively disable RPs.

The published check was added in #9495 as a way to fix #9494 for a 400 HTTP request in the Block Editor for a published post.

See #11560

See #11546

jeherve added a commit that referenced this pull request Apr 4, 2019
Fixes 3718-gh-jpop-issues

The curly quotes were added in #11220, but are not handled well by GlotPress. We need to
revert to using regular double quotes.
kraftbj pushed a commit that referenced this pull request Apr 17, 2019
Fixes 3718-gh-jpop-issues

The curly quotes were added in #11220, but are not handled well by GlotPress. We need to
revert to using regular double quotes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Related Posts [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack Touches WP.com Files [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants