feat: add disabledReason field to projects for better tracking of disable reasons

This commit is contained in:
Dries Augustyns
2026-05-22 13:03:32 +02:00
parent 9797aed47f
commit 94ceadbbe4
4 changed files with 27 additions and 4 deletions
+11 -1
View File
@@ -573,6 +573,16 @@ export class Webhooks {
signale.success(`[WEBHOOK] Invoice paid for project ${project.name} (${project.id})`);
// Re-enable the project only if it was previously disabled for a failed payment.
// Projects disabled for other reasons (reputation, phishing, manual) must stay disabled.
if (project.disabled && project.disabledReason === 'PAYMENT_FAILED') {
await prisma.project.update({
where: {id: project.id},
data: {disabled: false, disabledReason: null},
});
signale.success(`[WEBHOOK] Project ${project.name} (${project.id}) re-enabled after payment`);
}
// Send notification about invoice payment
await NtfyService.notifyInvoicePaid(project.name, project.id);
break;
@@ -606,7 +616,7 @@ export class Webhooks {
await prisma.project.update({
where: {id: project.id},
data: {disabled: true},
data: {disabled: true, disabledReason: 'PAYMENT_FAILED'},
});
await NtfyService.notifyProjectDisabledForPayment(project.name, project.id);
+2 -2
View File
@@ -713,7 +713,7 @@ export class SecurityService {
// Disable the project
await prisma.project.update({
where: {id: projectId},
data: {disabled: true},
data: {disabled: true, disabledReason: 'EMAIL_REPUTATION'},
});
// Log critical security event
@@ -971,7 +971,7 @@ ${strippedBody.substring(0, 2000)}`,
// Disable the project
await prisma.project.update({
where: {id: projectId},
data: {disabled: true},
data: {disabled: true, disabledReason: 'PHISHING_DETECTED'},
});
const violation = `A policy violation was detected. Please contact support for more details.`;