mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 08:16:05 -07:00
#96 fix up notification test feature
This commit is contained in:
parent
6fc4cbf9a4
commit
5a5512a1cd
1 changed files with 45 additions and 6 deletions
|
@ -397,8 +397,21 @@ namespace PlexRequests.UI.Modules
|
||||||
NotificationType = NotificationType.Test,
|
NotificationType = NotificationType.Test,
|
||||||
DateTime = DateTime.Now
|
DateTime = DateTime.Now
|
||||||
};
|
};
|
||||||
NotificationService.Publish(notificationModel, settings);
|
try
|
||||||
Log.Info("Sent email notification test");
|
{
|
||||||
|
NotificationService.Subscribe(new EmailMessageNotification(EmailService));
|
||||||
|
settings.Enabled = true;
|
||||||
|
NotificationService.Publish(notificationModel, settings);
|
||||||
|
Log.Info("Sent email notification test");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Log.Error("Failed to subscribe and publish test Email Notification");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
NotificationService.UnSubscribe(new EmailMessageNotification(EmailService));
|
||||||
|
}
|
||||||
return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully sent a test Email Notification!" });
|
return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully sent a test Email Notification!" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,8 +496,21 @@ namespace PlexRequests.UI.Modules
|
||||||
NotificationType = NotificationType.Test,
|
NotificationType = NotificationType.Test,
|
||||||
DateTime = DateTime.Now
|
DateTime = DateTime.Now
|
||||||
};
|
};
|
||||||
NotificationService.Publish(notificationModel, settings);
|
try
|
||||||
Log.Info("Sent pushbullet notification test");
|
{
|
||||||
|
NotificationService.Subscribe(new PushbulletNotification(PushbulletApi, PushbulletService));
|
||||||
|
settings.Enabled = true;
|
||||||
|
NotificationService.Publish(notificationModel, settings);
|
||||||
|
Log.Info("Sent pushbullet notification test");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Log.Error("Failed to subscribe and publish test Pushbullet Notification");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
NotificationService.UnSubscribe(new PushbulletNotification(PushbulletApi, PushbulletService));
|
||||||
|
}
|
||||||
return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully sent a test Pushbullet Notification!" });
|
return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully sent a test Pushbullet Notification!" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,8 +559,21 @@ namespace PlexRequests.UI.Modules
|
||||||
NotificationType = NotificationType.Test,
|
NotificationType = NotificationType.Test,
|
||||||
DateTime = DateTime.Now
|
DateTime = DateTime.Now
|
||||||
};
|
};
|
||||||
NotificationService.Publish(notificationModel, settings);
|
try
|
||||||
Log.Info("Sent pushover notification test");
|
{
|
||||||
|
NotificationService.Subscribe(new PushoverNotification(PushoverApi, PushoverService));
|
||||||
|
settings.Enabled = true;
|
||||||
|
NotificationService.Publish(notificationModel, settings);
|
||||||
|
Log.Info("Sent pushover notification test");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Log.Error("Failed to subscribe and publish test Pushover Notification");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
NotificationService.UnSubscribe(new PushoverNotification(PushoverApi, PushoverService));
|
||||||
|
}
|
||||||
return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully sent a test Pushover Notification!" });
|
return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully sent a test Pushover Notification!" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue