mirror of
https://github.com/nezhahq/nezha.git
synced 2025-03-11 08:18:13 -04:00
fix: notifier groups cache not initialized (#995)
This commit is contained in:
parent
65f9db7d5a
commit
029d6dbd5f
@ -163,6 +163,7 @@ func batchDeleteNotification(c *gin.Context) (any, error) {
|
||||
for _, nid := range n {
|
||||
if ns, ok := singleton.NotificationMap[nid]; ok {
|
||||
if !ns.HasPermission(c) {
|
||||
singleton.NotificationsLock.RUnlock()
|
||||
return nil, singleton.Localizer.ErrorT("permission denied")
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,12 @@ func loadNotifications() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
var groups []model.NotificationGroup
|
||||
DB.Find(&groups)
|
||||
for _, grp := range groups {
|
||||
NotificationGroup[grp.ID] = grp.Name
|
||||
}
|
||||
|
||||
NotificationMap = make(map[uint64]*model.Notification, len(NotificationListSorted))
|
||||
for i := range NotificationListSorted {
|
||||
NotificationMap[NotificationListSorted[i].ID] = NotificationListSorted[i]
|
||||
|
Loading…
Reference in New Issue
Block a user