mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Allow disabling notifications per user and disabling specific notifications per user (#1991)
* Allow disabling notifications per user and disabling specific notifications per use closes #1974 * Add disable notifs for all users * fix term generator for notifications * sow checkboxes instead of multiselect when js is enabled * remove js dependency * fix notif conditions
This commit is contained in:
@@ -21,7 +21,6 @@ namespace BTCPayServer.Services.Notifications
|
||||
private readonly IMemoryCache _memoryCache;
|
||||
private readonly EventAggregator _eventAggregator;
|
||||
private readonly Dictionary<string, INotificationHandler> _handlersByNotificationType;
|
||||
private readonly Dictionary<Type, INotificationHandler> _handlersByBlobType;
|
||||
|
||||
public NotificationManager(ApplicationDbContextFactory factory, UserManager<ApplicationUser> userManager,
|
||||
IMemoryCache memoryCache, IEnumerable<INotificationHandler> handlers, EventAggregator eventAggregator)
|
||||
@@ -31,7 +30,6 @@ namespace BTCPayServer.Services.Notifications
|
||||
_memoryCache = memoryCache;
|
||||
_eventAggregator = eventAggregator;
|
||||
_handlersByNotificationType = handlers.ToDictionary(h => h.NotificationType);
|
||||
_handlersByBlobType = handlers.ToDictionary(h => h.NotificationBlobType);
|
||||
}
|
||||
|
||||
private const int _cacheExpiryMs = 5000;
|
||||
@@ -118,12 +116,5 @@ namespace BTCPayServer.Services.Notifications
|
||||
return h;
|
||||
throw new InvalidOperationException($"No INotificationHandler found for {notificationId}");
|
||||
}
|
||||
|
||||
public INotificationHandler GetHandler(Type blobType)
|
||||
{
|
||||
if (_handlersByBlobType.TryGetValue(blobType, out var h))
|
||||
return h;
|
||||
throw new InvalidOperationException($"No INotificationHandler found for {blobType.Name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user