diff --git a/BTCPayServer/Controllers/NotificationsController.cs b/BTCPayServer/Controllers/NotificationsController.cs index 3736811bc..84336c958 100644 --- a/BTCPayServer/Controllers/NotificationsController.cs +++ b/BTCPayServer/Controllers/NotificationsController.cs @@ -32,6 +32,7 @@ namespace BTCPayServer.Controllers [HttpGet] public async Task Index(int skip = 0, int count = 50, int timezoneOffset = 0) { + // TODO: Refactor var claimWithId = User.Claims.SingleOrDefault(a => a.Type == ClaimTypes.NameIdentifier); if (claimWithId == null) return RedirectToAction("Index", "Home"); @@ -58,5 +59,20 @@ namespace BTCPayServer.Controllers await Task.Delay(1000); return RedirectToAction(nameof(Index)); } + + [HttpGet] + public async Task Delete(string id) + { + // TODO: Refactor + var claimWithId = User.Claims.SingleOrDefault(a => a.Type == ClaimTypes.NameIdentifier); + if (claimWithId == null) + return RedirectToAction("Index", "Home"); + + var notif = _db.Notifications.SingleOrDefault(a => a.Id == id && a.ApplicationUserId == claimWithId.Value); + _db.Notifications.Remove(notif); + await _db.SaveChangesAsync(); + + return RedirectToAction(nameof(Index)); + } } } diff --git a/BTCPayServer/Views/Notifications/Index.cshtml b/BTCPayServer/Views/Notifications/Index.cshtml index 75eaad9a0..8cd82c28b 100644 --- a/BTCPayServer/Views/Notifications/Index.cshtml +++ b/BTCPayServer/Views/Notifications/Index.cshtml @@ -17,18 +17,24 @@ }
-

Notices

+

@ViewData["Title"]


+
- + + @@ -46,9 +52,12 @@ {   } - - - } + + + + }
DateDate Message   
+ +