🐛 Fix batch notification prefs querying issue

This commit is contained in:
LittleSheep 2024-09-22 01:27:57 +08:00
parent 0a362dadec
commit 648f10b25a
2 changed files with 4 additions and 2 deletions

View File

@ -59,7 +59,7 @@ func NewNotification(notification models.Notification) error {
if err := database.C.Save(&notification).Error; err != nil {
return err
}
if err := PushNotification(notification); err != nil {
if err := PushNotification(notification, true); err != nil {
return err
}

View File

@ -56,7 +56,9 @@ func CheckNotificationNotifiable(account models.Account, topic string) bool {
func CheckNotificationNotifiableBatch(accounts []models.Account, topic string) []bool {
var notifications []models.PreferenceNotification
if err := database.C.Where("account_id IN ?", accounts).Find(&notifications).Error; err != nil {
if err := database.C.Where("account_id IN ?", lo.Map(accounts, func(item models.Account, index int) uint {
return item.ID
})).Find(&notifications).Error; err != nil {
return lo.Map(accounts, func(item models.Account, index int) bool {
return false
})