diff --git a/go.mod b/go.mod index 8256b65..3024fe0 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.23.2 require ( git.solsynth.dev/hypernet/nexus v0.0.0-20250216103838-15c39609b897 - git.solsynth.dev/hypernet/pusher v0.0.0-20241228030233-50ff8304e465 + git.solsynth.dev/hypernet/pusher v0.0.0-20250216145944-5fb769823a88 git.solsynth.dev/hypernet/wallet v0.0.0-20250129150034-87b94cdb5488 github.com/dgraph-io/ristretto v0.2.0 github.com/eko/gocache/lib/v4 v4.1.6 diff --git a/go.sum b/go.sum index 3ec6093..9e9caad 100644 --- a/go.sum +++ b/go.sum @@ -41,6 +41,8 @@ git.solsynth.dev/hypernet/nexus v0.0.0-20250216103838-15c39609b897 h1:AmLZ/r70e2 git.solsynth.dev/hypernet/nexus v0.0.0-20250216103838-15c39609b897/go.mod h1:v+rpf1ZDRi8moaThTAkj5DMQU+rw96YTHcN8/7n/p2Y= git.solsynth.dev/hypernet/pusher v0.0.0-20241228030233-50ff8304e465 h1:KFtv9lF0JMUGsq1uHwQvop8PTyqdiLuUQuRrd5WmzPk= git.solsynth.dev/hypernet/pusher v0.0.0-20241228030233-50ff8304e465/go.mod h1:XHTqFU/vBe4JiuAjl87GUcL8+w/IizSNoqH6n3WkQFc= +git.solsynth.dev/hypernet/pusher v0.0.0-20250216145944-5fb769823a88 h1:2HEENe9KUrdaJeNBzx9lsuXQGyzWqCgnLTKQnr8xFr8= +git.solsynth.dev/hypernet/pusher v0.0.0-20250216145944-5fb769823a88/go.mod h1:ildzMtLagNsLK0Rkw4Hgk2TrrwqZnjwJIUx0MNZwcDY= git.solsynth.dev/hypernet/wallet v0.0.0-20250129150034-87b94cdb5488 h1:/9Ol+PfDQFAYtHo0kk6sxqiEsZ6epb6yUEsZJxy14Mk= git.solsynth.dev/hypernet/wallet v0.0.0-20250129150034-87b94cdb5488/go.mod h1:jd1MTBI5NPHne22nq7nR7kyl4iYb9kV2A+tpXi7HOYY= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= diff --git a/pkg/authkit/models/notifications.go b/pkg/authkit/models/notifications.go index f069edc..784aac0 100644 --- a/pkg/authkit/models/notifications.go +++ b/pkg/authkit/models/notifications.go @@ -1,9 +1,10 @@ package models import ( + "time" + "git.solsynth.dev/hypernet/pusher/pkg/pushkit" "gorm.io/datatypes" - "time" ) type Notification struct { diff --git a/pkg/internal/services/notifications.go b/pkg/internal/services/notifications.go index e3530d3..98ab290 100644 --- a/pkg/internal/services/notifications.go +++ b/pkg/internal/services/notifications.go @@ -133,6 +133,9 @@ func PushNotification(notification models.Notification, skipNotifiableCheck ...b log.Debug().Str("topic", notification.Topic).Any("uid", notification.AccountID).Msg("Pushing notify to user...") err = gap.Px.PushNotifyBatch(pushkit.NotificationPushBatchRequest{ + Lang: lo.Map(subscribers, func(item models.NotificationSubscriber, index int) string { + return notification.Account.Language + }), Providers: providers, Tokens: tokens, Notification: notification.EncodeToPushkit(), @@ -213,6 +216,14 @@ func PushNotificationBatch(notifications []models.Notification, skipNotifiableCh } if err := gap.Px.PushNotifyBatch(pushkit.NotificationPushBatchRequest{ + Lang: lo.Map(subscribers, func(item models.NotificationSubscriber, index int) string { + for idx := 0; idx < len(notifications); idx++ { + if item.AccountID == notifications[idx].AccountID { + return notifications[idx].Account.Language + } + } + return "en-US" + }), Providers: providers, Tokens: tokens, Notification: notifications[0].EncodeToPushkit(),