mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-03 17:36:59 +01:00
Tweaking notification display and allowing deletion
This commit is contained in:
parent
31e0bb43e8
commit
3eb503b13b
2 changed files with 30 additions and 5 deletions
|
@ -32,6 +32,7 @@ namespace BTCPayServer.Controllers
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<IActionResult> Index(int skip = 0, int count = 50, int timezoneOffset = 0)
|
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);
|
var claimWithId = User.Claims.SingleOrDefault(a => a.Type == ClaimTypes.NameIdentifier);
|
||||||
if (claimWithId == null)
|
if (claimWithId == null)
|
||||||
return RedirectToAction("Index", "Home");
|
return RedirectToAction("Index", "Home");
|
||||||
|
@ -58,5 +59,20 @@ namespace BTCPayServer.Controllers
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
return RedirectToAction(nameof(Index));
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,18 +17,24 @@
|
||||||
}
|
}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 section-heading">
|
<div class="col-lg-12 section-heading">
|
||||||
<h2>Notices</h2>
|
<h2>@ViewData["Title"]</h2>
|
||||||
<hr class="primary">
|
<hr class="primary">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row button-row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<a asp-action="Generate" class="btn btn-primary" role="button" id="Generate"><span class="fa fa-plus"></span> Generate Test Notification</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<table class="table table-sm table-responsive-md">
|
<table class="table table-sm table-responsive-md">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="160px">Date</th>
|
<th width="165px">Date</th>
|
||||||
<th>Message</th>
|
<th>Message</th>
|
||||||
<th width="70px"> </th>
|
<th width="70px"> </th>
|
||||||
|
<th width="70px"> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -46,9 +52,12 @@
|
||||||
{
|
{
|
||||||
<span> </span>
|
<span> </span>
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
<td>
|
||||||
}
|
<a asp-action="Delete" asp-route-id="@item.Id"><span class="fa fa-trash"></span></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue