Remove unnecessary use of updateEmailMailPoetProperty

MAILPOET-6431
This commit is contained in:
Oluwaseun Olorunsola
2025-02-05 08:40:39 +01:00
committed by Oluwaseun Olorunsola
parent e5498b6baf
commit b16071ee0e
3 changed files with 2 additions and 36 deletions

View File

@@ -53,7 +53,6 @@ export function EmailSidebarExtensionBody({ RichTextWithButton }) {
href="https://www.mailpoet.com/blog/17-email-subject-line-best-practices-to-boost-engagement/"
target="_blank"
rel="noopener noreferrer"
onClick={() => {}}
/>
),
emojiLink: (
@@ -62,7 +61,6 @@ export function EmailSidebarExtensionBody({ RichTextWithButton }) {
href="https://www.mailpoet.com/blog/tips-using-emojis-in-subject-lines/"
target="_blank"
rel="noopener noreferrer"
onClick={() => {}}
/>
),
},
@@ -86,7 +84,6 @@ export function EmailSidebarExtensionBody({ RichTextWithButton }) {
key="preview-text-kb"
target="_blank"
rel="noopener noreferrer"
onClick={() => {}}
/>
),
},
@@ -100,10 +97,7 @@ export function EmailSidebarExtensionBody({ RichTextWithButton }) {
updateProperty={updateEmailMailPoetProperty}
label={__('Subject', 'mailpoet')}
labelSuffix={
<ExternalLink
href="https://kb.mailpoet.com/article/435-a-guide-to-personalisation-tags-for-tailored-newsletters#list"
onClick={() => {}}
>
<ExternalLink href="https://kb.mailpoet.com/article/435-a-guide-to-personalisation-tags-for-tailored-newsletters#list">
{__('Guide', 'mailpoet')}
</ExternalLink>
}

View File

@@ -35,8 +35,7 @@ export function MoreMenu(): JSX.Element {
editorCurrentPostType,
'status'
);
const { saveEditedEmail, updateEmailMailPoetProperty } =
useDispatch( storeName );
const { saveEditedEmail } = useDispatch( storeName );
const goToListings = () => {
window.location.href = urls.listings;
};
@@ -132,10 +131,6 @@ export function MoreMenu(): JSX.Element {
<MenuItem
onClick={ async () => {
await setStatus( 'draft' );
await updateEmailMailPoetProperty(
'deleted_at',
''
);
await saveEditedEmail();
recordEvent(
'header_more_menu_restore_from_trash_button_clicked'

View File

@@ -134,29 +134,6 @@ export function* saveEditedEmail() {
} );
}
export function* updateEmailMailPoetProperty( name: string, value: string ) {
const postId = select( storeName ).getEmailPostId();
// There can be a better way how to get the edited post data
const editedPost = select( coreDataStore ).getEditedEntityRecord(
'postType',
editorCurrentPostType,
postId
);
// @ts-expect-error Property 'mailpoet_data' does not exist on type 'Updatable<Attachment<any>>'.
const mailpoetData = editedPost?.mailpoet_data || {};
yield dispatch( coreDataStore ).editEntityRecord(
'postType',
editorCurrentPostType,
postId,
{
mailpoet_data: {
...mailpoetData,
[ name ]: value,
},
}
);
}
export const setTemplateToPost =
( templateSlug ) =>
async ( { registry } ) => {