Reintroduce the client-side filtering of email templates
We still need to filter the templates because, in some cases, the API also returns custom templates ignoring the post_type filter in the query [MAILPOET-6279]
This commit is contained in:
committed by
Jan Lysý
parent
1626ded39a
commit
c015092133
@ -196,10 +196,18 @@ export const getCurrentTemplate = createRegistrySelector((select) => () => {
|
||||
*/
|
||||
export const getEmailTemplates = createRegistrySelector(
|
||||
(select) => () =>
|
||||
select(coreDataStore).getEntityRecords('postType', 'wp_template', {
|
||||
per_page: -1,
|
||||
post_type: 'mailpoet_email',
|
||||
}),
|
||||
select(coreDataStore)
|
||||
.getEntityRecords('postType', 'wp_template', {
|
||||
per_page: -1,
|
||||
post_type: 'mailpoet_email',
|
||||
})
|
||||
// We still need to filter the templates because, in some cases, the API also returns custom templates
|
||||
// ignoring the post_type filter in the query
|
||||
?.filter(
|
||||
(template) =>
|
||||
// @ts-expect-error Missing property in type
|
||||
template.theme === 'mailpoet/mailpoet',
|
||||
),
|
||||
);
|
||||
|
||||
export function getEmailPostId(state: State): number {
|
||||
|
Reference in New Issue
Block a user