Finished the notification for the fault queue

pull/687/head
Jamie.Rees 8 years ago
parent c5b65a335f
commit bcfd675d3d

@ -81,6 +81,11 @@ namespace PlexRequests.Services.Notification
case NotificationType.Test: case NotificationType.Test:
await PushTestAsync(pushSettings); await PushTestAsync(pushSettings);
break; break;
case NotificationType.RequestDeclined:
break;
case NotificationType.ItemAddedToFaultQueue:
await PushFaultQueue(model, pushSettings);
break;
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
@ -125,6 +130,13 @@ namespace PlexRequests.Services.Notification
await Push(settings, message, pushTitle); await Push(settings, message, pushTitle);
} }
private async Task PushFaultQueue(NotificationModel model, PushbulletNotificationSettings settings)
{
var message = $"Hello! The user '{model.User}' has requested {model.Title} but it could not be added. This has been added into the requests queue and will keep retrying";
var pushTitle = $"Plex Requests: The {model.RequestType.GetString()?.ToLower()} {model.Title} has been requested but could not be added!";
await Push(settings, message, pushTitle);
}
private async Task Push(PushbulletNotificationSettings settings, string message, string title) private async Task Push(PushbulletNotificationSettings settings, string message, string title)
{ {
try try

@ -81,6 +81,11 @@ namespace PlexRequests.Services.Notification
case NotificationType.Test: case NotificationType.Test:
await PushTestAsync(model, pushSettings); await PushTestAsync(model, pushSettings);
break; break;
case NotificationType.RequestDeclined:
break;
case NotificationType.ItemAddedToFaultQueue:
await PushFaultQueue(model, pushSettings);
break;
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
@ -122,6 +127,12 @@ namespace PlexRequests.Services.Notification
await Push(settings, message); await Push(settings, message);
} }
private async Task PushFaultQueue(NotificationModel model, PushoverNotificationSettings settings)
{
var message = $"Hello! The user '{model.User}' has requested {model.Title} but it could not be added. This has been added into the requests queue and will keep retrying";
await Push(settings, message);
}
private async Task Push(PushoverNotificationSettings settings, string message) private async Task Push(PushoverNotificationSettings settings, string message)
{ {
try try

@ -88,6 +88,11 @@ namespace PlexRequests.Services.Notification
case NotificationType.Test: case NotificationType.Test:
await PushTest(pushSettings); await PushTest(pushSettings);
break; break;
case NotificationType.RequestDeclined:
break;
case NotificationType.ItemAddedToFaultQueue:
await PushFaultQueue(model, pushSettings);
break;
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
@ -111,6 +116,12 @@ namespace PlexRequests.Services.Notification
await Push(settings, message); await Push(settings, message);
} }
private async Task PushFaultQueue(NotificationModel model, SlackNotificationSettings settings)
{
var message = $"Hello! The user '{model.User}' has requested {model.Title} but it could not be added. This has been added into the requests queue and will keep retrying";
await Push(settings, message);
}
private async Task Push(SlackNotificationSettings config, string message) private async Task Push(SlackNotificationSettings config, string message)
{ {
try try

Loading…
Cancel
Save