fix: refetch contact after awaiting triggers

This commit is contained in:
Nik Lampe
2024-09-09 08:57:26 +02:00
parent b373827335
commit 3f70be95dd
@@ -71,6 +71,13 @@ export class ActionService {
const triggers = await ContactService.triggers(contact.id);
// Refetch the contact, as it may have subscribed now
contact = await prisma.contact.findUniqueOrThrow({
where: {
id: contact.id,
},
});
for (const action of actions) {
const hasTriggeredAction = !!triggers.find((t) => t.actionId === action.id);