btcpayserver/BTCPayServer/Extensions/UserExtensions.cs
Samuel Adams ec68d2a0e6
Remove Confirmed state in UI (#3090)
* Remove Confirmed state in UI

Closes #1789.

* Add infobox & improve refund tooltip

* Update BTCPayServer/Views/Invoice/ListInvoices.cshtml

Add @dennisreimann suggestion

Co-authored-by: d11n <mail@dennisreimann.de>

* Add "don't show again" button

Adds a "Don't Show Again" button to the infobox. Also a bugfix that was preventing the new status from showing in the invoice details page.

* Add User blob and move invoice status notice to it

Co-authored-by: d11n <mail@dennisreimann.de>
Co-authored-by: Kukks <evilkukka@gmail.com>
2021-11-26 23:13:41 +09:00

33 lines
977 B
C#

using System.Linq;
using BTCPayServer.Data;
using BTCPayServer.Services.Invoices;
using Newtonsoft.Json.Linq;
namespace BTCPayServer
{
public static class UserExtensions
{
public static UserBlob GetBlob(this ApplicationUser user)
{
var result = user.Blob == null
? new UserBlob()
: JObject.Parse(ZipUtils.Unzip(user.Blob)).ToObject<UserBlob>();
return result;
}
public static bool SetBlob(this ApplicationUser user, UserBlob blob)
{
var newBytes = InvoiceRepository.ToBytes(blob);
if (user.Blob != null && newBytes.SequenceEqual(user.Blob))
{
return false;
}
user.Blob = newBytes;
return true;
}
}
public class UserBlob
{
public bool ShowInvoiceStatusChangeHint { get; set; }
}
}