change alert link to use system ID instead of name

This commit is contained in:
henrygd
2025-11-10 17:31:11 -05:00
parent 01d20562f0
commit 02abfbcb54
2 changed files with 4 additions and 9 deletions

View File

@@ -161,19 +161,14 @@ func (am *AlertManager) sendStatusAlert(alertStatus string, systemName string, a
title := fmt.Sprintf("Connection to %s is %s %v", systemName, alertStatus, emoji)
message := strings.TrimSuffix(title, emoji)
// if errs := am.hub.ExpandRecord(alertRecord, []string{"user"}, nil); len(errs) > 0 {
// return errs["user"]
// }
// user := alertRecord.ExpandedOne("user")
// if user == nil {
// return nil
// }
// Get system ID for the link
systemID := alertRecord.GetString("system")
return am.SendAlert(AlertMessageData{
UserID: alertRecord.GetString("user"),
Title: title,
Message: message,
Link: am.hub.MakeLink("system", systemName),
Link: am.hub.MakeLink("system", systemID),
LinkText: "View " + systemName,
})
}

View File

@@ -298,7 +298,7 @@ func (am *AlertManager) sendSystemAlert(alert SystemAlertData) {
UserID: alert.alertRecord.GetString("user"),
Title: subject,
Message: body,
Link: am.hub.MakeLink("system", systemName),
Link: am.hub.MakeLink("system", alert.systemRecord.Id),
LinkText: "View " + systemName,
})
}