Fix paid invoice filter

Fixes #3434 by reverting the filter changes done [here](ec68d2a0e6 (diff-b7a89b0b45f062f004cdfe6ca8484f6ca519044f63485fd15986af5f7dd5ec76L219)).

The new labels are only used in the UI ­— when filtering one needs to use the old labels, as the filter docs in the view already suggest.
This commit is contained in:
Dennis Reimann 2022-02-08 16:05:41 +01:00 committed by nicolas.dorier
parent 1c1f69fa50
commit 4ca152da7c
No known key found for this signature in database
GPG key ID: 6618763EF09186FE
2 changed files with 22 additions and 6 deletions

View file

@ -651,7 +651,25 @@ namespace BTCPayServer.Services.Invoices
if (queryObject.Status != null && queryObject.Status.Length > 0)
{
var statusSet = queryObject.Status.ToHashSet().ToArray();
HashSet<string> statusSet = new HashSet<string>();
// We make sure here that the old filters still work
foreach (var status in queryObject.Status.Select(s => s.ToLowerInvariant()))
{
if (status == "paid")
statusSet.Add("processing");
if (status == "processing")
statusSet.Add("paid");
if (status == "confirmed")
{
statusSet.Add("complete");
statusSet.Add("settled");
}
if (status == "settled")
{
statusSet.Add("complete");
statusSet.Add("confirmed");
}
}
query = query.Where(i => statusSet.Contains(i.Status));
}

View file

@ -327,10 +327,9 @@
</div>
</span>
</div>
<div style="clear:both"></div>
@if (Model.Total > 0)
{
<div style="clear:both"></div>
<div class="table-responsive">
<table id="invoices" class="table table-hover">
<thead>
@ -403,11 +402,10 @@
else
{
<span class="badge badge-@invoice.Status.Status.ToModernStatus().ToString().ToLower()">
@invoice.Status.Status.ToModernStatus().ToString() @* @invoice.Status.ToString().ToLower() *@
@invoice.Status.Status.ToModernStatus().ToString()
@if (invoice.Status.ExceptionStatus != InvoiceExceptionStatus.None)
{
@String.Format("({0})", @invoice.Status.ExceptionStatus.ToString())
;
@($"({invoice.Status.ExceptionStatus.ToString()})")
}
</span>
}