mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04:26 +01:00
Tweaking notification display and allowing deletion
This commit is contained in:
@@ -32,6 +32,7 @@ namespace BTCPayServer.Controllers
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> 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<IActionResult> 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user