mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 04:30:05 +00:00
fix: notifier groups cache not initialized (#995)
This commit is contained in:
@@ -163,6 +163,7 @@ func batchDeleteNotification(c *gin.Context) (any, error) {
|
|||||||
for _, nid := range n {
|
for _, nid := range n {
|
||||||
if ns, ok := singleton.NotificationMap[nid]; ok {
|
if ns, ok := singleton.NotificationMap[nid]; ok {
|
||||||
if !ns.HasPermission(c) {
|
if !ns.HasPermission(c) {
|
||||||
|
singleton.NotificationsLock.RUnlock()
|
||||||
return nil, singleton.Localizer.ErrorT("permission denied")
|
return nil, singleton.Localizer.ErrorT("permission denied")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,12 @@ func loadNotifications() {
|
|||||||
panic(err)
|
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))
|
NotificationMap = make(map[uint64]*model.Notification, len(NotificationListSorted))
|
||||||
for i := range NotificationListSorted {
|
for i := range NotificationListSorted {
|
||||||
NotificationMap[NotificationListSorted[i].ID] = NotificationListSorted[i]
|
NotificationMap[NotificationListSorted[i].ID] = NotificationListSorted[i]
|
||||||
|
|||||||
Reference in New Issue
Block a user