Feature: Multi-email alerts and move resource between groups
- notificationService: Parse comma-separated emails from resource.email_to or global config; validate and send to each recipient - API: Add PATCH /api/resources/:id/group endpoint to move resource between groups with validation and cache invalidation - UI: Add group selector to edit modal; wire group change to PATCH endpoint; add help text for multi-email format
This commit is contained in:
1 parent
9c1c972045
commit
923c36e494
12 files changed
+115
-12
No files matched your search
@@ -76,8 +76,17 @@ class NotificationService {
|
||||
const promises = [];
|
||||
|
||||
// Use resource-specific email if provided, otherwise fall back to global config
|
||||
if (this.emailEnabled && (resource.email_to || this.config.email_to)) {
|
||||
promises.push(this.sendEmail(resource, message, incident.type, stats));
|
||||
if (this.emailEnabled && (resource.email_to || this.config.email_to)) {
|
||||
const targetsCsv = resource.email_to || this.config.email_to;
|
||||
const targets = String(targetsCsv)
|
||||
.split(',')
|
||||
.map(t => t.trim())
|
||||
.filter(t => t && /.+@.+\..+/.test(t));
|
||||
if (targets.length > 0) {
|
||||
for (const email of targets) {
|
||||
promises.push(this.sendEmail(resource, message, incident.type, stats, email));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!this.emailEnabled) {
|
||||
// Email globally disabled
|
||||
@@ -158,7 +167,7 @@ class NotificationService {
|
||||
htmlContent += `</div>`;
|
||||
|
||||
// Use resource-specific email if provided, otherwise use global config
|
||||
const emailTo = resource.email_to || this.config.email_to;
|
||||
const emailTo = emailOverride || resource.email_to || this.config.email_to;
|
||||
|
||||
await this.transporter.sendMail({
|
||||
from: this.config.email_from,
|
||||
|
||||
Reference in new issue
Block a user