🌐 Fully localized notification

This commit is contained in:
2025-02-01 17:59:58 +08:00
parent d7ee87433f
commit b68aed0284
5 changed files with 48 additions and 64 deletions

View File

@ -42,9 +42,8 @@ func UpdateAbuseReportStatus(id uint, status, message string) error {
_ = NewNotification(models.Notification{
Topic: "reports.feedback",
Title: "Abuse report status has been changed.",
Subtitle: fmt.Sprintf("The report #%d's status updated", id),
Body: fmt.Sprintf("The report created by you with ID #%d's status has been changed to %s. Moderator message: %s", id, status, message),
Title: GetLocalizedString("subjectAbuseReportUpdated", account.Language),
Body: fmt.Sprintf(GetLocalizedString("shortBodyAbuseReportUpdated", account.Language), id, status, message),
Account: account,
AccountID: account.ID,
})

View File

@ -129,10 +129,9 @@ func ActiveTicket(ticket models.AuthTicket) (models.AuthTicket, error) {
return ticket, err
} else {
_ = NewNotification(models.Notification{
Topic: "passport.security.alert",
Title: "New sign in alert",
Subtitle: fmt.Sprintf("New sign in from %s", ticket.IpAddress),
Body: fmt.Sprintf("Your account just got a new sign in from %s. Make sure you recongize this device, or sign out it immediately and reset password.", ticket.IpAddress),
Topic: "passport.security.alert",
Title: GetLocalizedString("subjectLoginAlert", ticket.Account.Language),
Body: fmt.Sprintf(GetLocalizedString("shortBodyLoginAlert", ticket.Account.Language), ticket.IpAddress),
Metadata: datatypes.JSONMap{
"ip_address": ticket.IpAddress,
"created_at": ticket.CreatedAt,