Merge pull request #19 from ranshamay/mail-fixes2

filter mass mails
pull/557/head
Ran Shamay 2 years ago committed by GitHub
commit 4110a5e3ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -79,7 +79,7 @@ module.exports = {
request: this.req, request: this.req,
}) })
.intercept('userAlreadyCardMember', () => Errors.USER_ALREADY_CARD_MEMBER); .intercept('userAlreadyCardMember', () => Errors.USER_ALREADY_CARD_MEMBER);
await sendUserEmails({ to: [inputs.userId], subject: 'b', text: 'c' }); await sendUserEmails({ to: [inputs.userId], subject: 'משימה חדשה ניתנה', text: 'c' });
return { return {
item: cardMembership, item: cardMembership,
}; };

@ -28,8 +28,8 @@ const sendEmail = async ({ to, subject, text, cc }) => {
} }
}; };
const sendUserEmails = async ({ ids, subject, text, cc }) => { const sendUserEmails = async ({ to, subject, text, cc }) => {
const users = await sails.helpers.users.getMany(ids); const users = await sails.helpers.users.getMany({ id: { in: to } });
return sendEmail({ to: users.map((u) => u.email), subject, text, cc }); return sendEmail({ to: users.map((u) => u.email), subject, text, cc });
}; };

Loading…
Cancel
Save