diff --git a/cmd/dashboard/controller/notification.go b/cmd/dashboard/controller/notification.go index 7fd87a1..706193c 100644 --- a/cmd/dashboard/controller/notification.go +++ b/cmd/dashboard/controller/notification.go @@ -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") } } diff --git a/service/singleton/notification.go b/service/singleton/notification.go index 9029996..2cab128 100644 --- a/service/singleton/notification.go +++ b/service/singleton/notification.go @@ -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]