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

Only check if the imported excerpt is not blank to return imported ex… #2964

Open
wants to merge 1 commit into
base: release/B20.01
from

Conversation

@codingmusician
Copy link

codingmusician commented Jan 2, 2020

…cerpt. Otherwise return post's excerpt

…cerpt. Otherwise return post's excerpt
@codingmusician codingmusician requested a review from mitogh Jan 2, 2020
@codingmusician

This comment has been minimized.

Copy link
Author

codingmusician commented Jan 2, 2020

Ref: https://moderntribe.atlassian.net/browse/EA-48

We want uploaded excerpts (via CSV) to override the post's excerpt whether or not an excerpt for the post exists.

Copy link
Member

mitogh left a comment

Small suggestion and a follow up question overall looks great 👍

@@ -456,7 +456,7 @@ private function get_post_excerpt( $event_id, $import_excerpt ) {
if ( $event_id ) {
$post_excerpt = get_post( $event_id )->post_excerpt;

return empty( $post_excerpt ) && ! empty( $import_excerpt ) ? $import_excerpt : $post_excerpt;
return !empty( $import_excerpt ) ? $import_excerpt : $post_excerpt;

This comment has been minimized.

Copy link
@mitogh

mitogh Jan 2, 2020

Member

Small suggestion to remove the need to use a negation operator here.

Suggested change
return !empty( $import_excerpt ) ? $import_excerpt : $post_excerpt;
return empty( $import_excerpt ) ? $post_excerpt : $import_excerpt;

This comment has been minimized.

Copy link
@mitogh

mitogh Jan 2, 2020

Member

Another question about this one, here we are assuming $post_excerpt is not empty, is there any other check before this one to ensure the returned value is not empty in case $post_excerpt is not empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.