parcelvoy / platform

Parcelvoy: Open source multi-channel marketing automation platform. Send data-driven emails, sms, push notifications and more!
https://parcelvoy.com
MIT License
257 stars 47 forks source link

added check unsubscribe om emailjob handler #536

Closed leobarcellos closed 1 week ago

leobarcellos commented 2 weeks ago

We noticed that sometimes users were receiving emails after unsubscribe event

image

I also noticed, @pushchris, that on CampaignService.ts, on sendCampaignJob function, this comment: image

I tried to put the unsubscribe check there, but since it's expecting a EmailJob, I could not (I could throw an Error there, but I don't know how it would behave)

So, I ended up putting on the EmailJob handler, since it already have a catch that fires the failSend.

Does it makes sense?

pushchris commented 1 week ago

Definitely right train of thought, the check should be in the MessageTriggerService though to make sure it applies to all channels appropriately. Merged a separate PR in with the changes in the interest of expediency