Skip to content

Commit

Permalink
FIO-7623: Fixes an issue where Email action with Logs turned on will …
Browse files Browse the repository at this point in the history
…fail for the nested form with Attach Submission PDF
  • Loading branch information
alexandraRamanenka committed Jan 25, 2024
1 parent aaeb573 commit 89f25da
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/actions/EmailAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,16 @@ module.exports = (router) => {
// Save off the req.params since they get deleted after the response and we need them later.
const reqParams = req.params;

res.on('finish', () => {
// Restore the req.params after the response was sent
req.params = reqParams;
});
// Dont block on sending emails.
next(); // eslint-disable-line callback-return

// Get the email parameters.
emailer.getParams(req, res, form, req.body)
.then((params) => {
req.params = reqParams;
const query = {
_id: params.owner,
deleted: {$eq: null},
Expand Down Expand Up @@ -253,6 +256,8 @@ module.exports = (router) => {
.then((template) => {
this.settings.message = template;
setActionItemMessage('Sending message', this.message);

req.params = reqParams;
emailer.send(req, res, this.settings, params, (err) => {
if (err) {
setActionItemMessage('Error sending message', {
Expand Down

0 comments on commit 89f25da

Please sign in to comment.