Enhance mailing plugin with collection overrides, detailed access controls, and improved rich text serialization logic

This commit is contained in:
2025-09-13 12:24:19 +02:00
parent 3868e74770
commit 5c9ef19d69
4 changed files with 279 additions and 25 deletions

View File

@@ -52,7 +52,10 @@ export const mailingPlugin = (pluginConfig: MailingPluginConfig) => (config: Con
},
// Update relationship fields to point to correct templates collection
fields: (emailsOverrides.fields || Emails.fields).map((field: any) => {
if (field.name === 'template' && field.type === 'relationship') {
if (field &&
typeof field === 'object' &&
field.name === 'template' &&
field.type === 'relationship') {
return {
...field,
relationTo: templatesSlug,
@@ -95,12 +98,10 @@ export const mailingPlugin = (pluginConfig: MailingPluginConfig) => (config: Con
}
} catch (error) {
console.error('❌ Error processing email queue:', error)
return {
output: {
success: false,
error: error instanceof Error ? error.message : 'Unknown error'
}
}
const errorMessage = error instanceof Error ? error.message : 'Unknown error'
// Properly fail the job by throwing the error
throw new Error(`Email queue processing failed: ${errorMessage}`)
}
},
interfaceName: 'ProcessEmailQueueJob',