Merge pull request #1853 from Kukks/not-if-test-func

Add debug notifications
This commit is contained in:
Nicolas Dorier
2020-08-20 13:00:33 +09:00
committed by GitHub
3 changed files with 34 additions and 1 deletions

View File

@@ -87,7 +87,18 @@ namespace BTCPayServer.Controllers
return new EmptyResult();
}
#if DEBUG
[HttpGet]
public async Task<IActionResult> GenerateJunk(int x = 100)
{
for (int i = 0; i < x; i++)
{
await _notificationSender.SendNotification(new AdminScope(), new JunkNotification());
}
return RedirectToAction("Index");
}
#endif
[HttpGet]
public IActionResult Index(int skip = 0, int count = 50, int timezoneOffset = 0)
{

View File

@@ -247,6 +247,9 @@ namespace BTCPayServer.Hosting
services.AddSingleton<INotificationHandler, InvoiceEventNotification.Handler>();
services.AddSingleton<INotificationHandler, PayoutNotification.Handler>();
#if DEBUG
services.AddSingleton<INotificationHandler, JunkNotification.Handler>();
#endif
services.TryAddSingleton<ExplorerClientProvider>();
services.TryAddSingleton<Bitpay>(o =>
{

View File

@@ -0,0 +1,19 @@
#if DEBUG
using BTCPayServer.Models.NotificationViewModels;
namespace BTCPayServer.Services.Notifications.Blobs
{
internal class JunkNotification
{
internal class Handler : NotificationHandler<JunkNotification>
{
public override string NotificationType => "junk";
protected override void FillViewModel(JunkNotification notification, NotificationViewModel vm)
{
vm.Body = $"All your junk r belong to us!";
}
}
}
}
#endif