mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 08:16:05 -07:00
Added the actual notification part of #27
This commit is contained in:
parent
3ea708aca5
commit
c50e2bb644
9 changed files with 135 additions and 113 deletions
|
@ -41,6 +41,11 @@ namespace PlexRequests.Services.Notification
|
|||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
public ConcurrentDictionary<string, INotification> Observers { get; } = new ConcurrentDictionary<string, INotification>();
|
||||
|
||||
/// <summary>
|
||||
/// Sends a notification to the user. This one is used in normal notification scenarios
|
||||
/// </summary>
|
||||
/// <param name="model">The model.</param>
|
||||
/// <returns></returns>
|
||||
public async Task Publish(NotificationModel model)
|
||||
{
|
||||
var notificationTasks = Observers.Values.Select(notification => NotifyAsync(notification, model));
|
||||
|
@ -48,6 +53,12 @@ namespace PlexRequests.Services.Notification
|
|||
await Task.WhenAll(notificationTasks).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a notification to the user, this is usually for testing the settings.
|
||||
/// </summary>
|
||||
/// <param name="model">The model.</param>
|
||||
/// <param name="settings">The settings.</param>
|
||||
/// <returns></returns>
|
||||
public async Task Publish(NotificationModel model, Settings settings)
|
||||
{
|
||||
var notificationTasks = Observers.Values.Select(notification => NotifyAsync(notification, model, settings));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue