🐛 Fix batch notification prefs querying issue
This commit is contained in:
parent
0a362dadec
commit
648f10b25a
@ -59,7 +59,7 @@ func NewNotification(notification models.Notification) error {
|
|||||||
if err := database.C.Save(¬ification).Error; err != nil {
|
if err := database.C.Save(¬ification).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := PushNotification(notification); err != nil {
|
if err := PushNotification(notification, true); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,9 @@ func CheckNotificationNotifiable(account models.Account, topic string) bool {
|
|||||||
|
|
||||||
func CheckNotificationNotifiableBatch(accounts []models.Account, topic string) []bool {
|
func CheckNotificationNotifiableBatch(accounts []models.Account, topic string) []bool {
|
||||||
var notifications []models.PreferenceNotification
|
var notifications []models.PreferenceNotification
|
||||||
if err := database.C.Where("account_id IN ?", accounts).Find(¬ifications).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(¬ifications).Error; err != nil {
|
||||||
return lo.Map(accounts, func(item models.Account, index int) bool {
|
return lo.Map(accounts, func(item models.Account, index int) bool {
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user