Fix missing tx refrence, https://github.com/Mailtrain-org/mailtrain/issues/811
This commit is contained in:
parent
9d4506977d
commit
2204bbe70c
2 changed files with 8 additions and 6 deletions
|
@ -682,7 +682,7 @@ async function queueCampaignMessageTx(tx, sendConfigurationId, listId, subscript
|
|||
});
|
||||
}
|
||||
|
||||
async function queueAPITransactionalMessage(sendConfigurationId, email, subject, html, text, tagLanguage, mergeTags, attachments) {
|
||||
async function queueAPITransactionalMessage(tx, sendConfigurationId, email, subject, html, text, tagLanguage, mergeTags, attachments) {
|
||||
const msgData = {
|
||||
to: {
|
||||
address: email
|
||||
|
|
|
@ -163,13 +163,15 @@ async function remove(context, id) {
|
|||
}
|
||||
|
||||
async function sendAsTransactionalEmail(context, templateId, sendConfigurationId, emails, subject, mergeTags, attachments) {
|
||||
const template = await getById(context, templateId, false);
|
||||
await knex.transaction(async tx => {
|
||||
const template = await getById(context, templateId, false);
|
||||
|
||||
await shares.enforceEntityPermission(context, 'sendConfiguration', sendConfigurationId, 'sendWithoutOverrides');
|
||||
await shares.enforceEntityPermission(context, 'sendConfiguration', sendConfigurationId, 'sendWithoutOverrides');
|
||||
|
||||
for (const email of emails) {
|
||||
await messageSender.queueAPITransactionalMessage(sendConfigurationId, email, subject, template.html, template.text, template.tag_language, {...mergeTags, EMAIL: email }, attachments);
|
||||
}
|
||||
for (const email of emails) {
|
||||
await messageSender.queueAPITransactionalMessage(tx, sendConfigurationId, email, subject, template.html, template.text, template.tag_language, {...mergeTags, EMAIL: email }, attachments);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue