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(
( select ) => () => {
const posts: EmailEditorPostType[] = select(
coreDataStore
).getEntityRecords( 'postType', 'mailpoet_email', {
per_page: 30, // show a maximum of 30 for now
status: 'publish,sent', // show only sent emails
} );
return posts;
}
( select ) => () =>
select( coreDataStore )
.getEntityRecords( 'postType', 'mailpoet_email', {
per_page: 30, // show a maximum of 30 for now
status: 'publish,sent', // show only sent emails
} )
?.filter(
( post: EmailEditorPostType ) => post?.content?.raw !== '' // filter out empty content
)
);
/**