Filter out empty email post-content

MAILPOET-5949
This commit is contained in:
Oluwaseun Olorunsola
2024-12-05 23:08:43 +01:00
committed by Oluwaseun Olorunsola
parent f79c0cec55
commit 4f948dfd65

View File

@ -140,16 +140,15 @@ export const getEditedEmailContent = createRegistrySelector(
); );
export const getSentEmailEditorPosts = createRegistrySelector( export const getSentEmailEditorPosts = createRegistrySelector(
( select ) => () => { ( select ) => () =>
const posts: EmailEditorPostType[] = select( select( coreDataStore )
coreDataStore .getEntityRecords( 'postType', 'mailpoet_email', {
).getEntityRecords( 'postType', 'mailpoet_email', {
per_page: 30, // show a maximum of 30 for now per_page: 30, // show a maximum of 30 for now
status: 'publish,sent', // show only sent emails status: 'publish,sent', // show only sent emails
} ); } )
?.filter(
return posts; ( post: EmailEditorPostType ) => post?.content?.raw !== '' // filter out empty content
} )
); );
/** /**