Add "Mark all as seen" button to notification dropdown (#2101)

This commit is contained in:
Umar Bolatov
2020-12-11 21:14:50 -08:00
committed by GitHub
parent 0d144d088e
commit b1e9c005b7
3 changed files with 19 additions and 0 deletions

View File

@@ -206,6 +206,17 @@ namespace BTCPayServer.Controllers
return RedirectToAction(nameof(Index));
}
[HttpPost]
public async Task<IActionResult> MarkAllAsSeen(string returnUrl)
{
if (!ValidUserClaim(out var userId))
{
return NotFound();
}
await _notificationManager.ToggleSeen(new NotificationsQuery() {Seen = false, UserId = userId}, true);
return Redirect(returnUrl);
}
private bool ValidUserClaim(out string userId)
{
userId = _userManager.GetUserId(User);