Do not show cheatmode in release, fix warnigns

This commit is contained in:
nicolas.dorier 2023-07-25 10:50:34 +09:00
parent 05b01a13c8
commit 4bffe117a9
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE
4 changed files with 14 additions and 17 deletions

View File

@ -53,7 +53,7 @@ namespace BTCPayServer.Controllers.Greenfield
private static LightningAutomatedPayoutSettings ToModel(PayoutProcessorData data)
{
var blob = data.HasTypedBlob<LightningAutomatedPayoutBlob>().GetBlob();
var blob = data.HasTypedBlob<LightningAutomatedPayoutBlob>().GetBlob() ?? new LightningAutomatedPayoutBlob();
return new LightningAutomatedPayoutSettings()
{
PaymentMethod = data.PaymentMethod,

View File

@ -106,13 +106,13 @@ public class OnChainWalletReportProvider : ReportProvider
}
var objects = await WalletRepository.GetWalletObjects(new GetWalletObjectsQuery()
{
Ids = queryContext.Data.Select(d => (string)d[2]).ToArray(),
Ids = queryContext.Data.Select(d => (string)d[2]!).ToArray(),
WalletId = walletId,
Type = "tx"
});
foreach (var row in queryContext.Data)
{
if (!objects.TryGetValue(new WalletObjectId(walletId, "tx", (string)row[2]), out var txObject))
if (!objects.TryGetValue(new WalletObjectId(walletId, "tx", (string)row[2]!), out var txObject))
continue;
var invoiceId = txObject.GetLinks().Where(t => t.type == "invoice").Select(t => t.id).FirstOrDefault();
row[3] = invoiceId;

View File

@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
@ -17,18 +18,20 @@ namespace BTCPayServer.Services.Reporting
public DateTimeOffset To { get; }
public ViewDefinition? ViewDefinition { get; set; }
public IList<object> AddData()
public IList<object?> AddData()
{
var l = CreateData();
Data.Add(l);
return l;
}
public IList<object> CreateData()
public IList<object?> CreateData()
{
return new List<object>(ViewDefinition.Fields.Count);
if (ViewDefinition is null)
throw new InvalidOperationException("You need to initialize ViewDefinition first");
return new List<object?>(ViewDefinition.Fields.Count);
}
public IList<IList<object>> Data { get; set; } = new List<IList<object>>();
public IList<IList<object?>> Data { get; set; } = new List<IList<object?>>();
}
}

View File

@ -1,26 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.TagHelpers;
using System.Xml.Linq;
using BTCPayServer.Configuration;
namespace BTCPayServer.TagHelpers;
[HtmlTargetElement(Attributes = "[cheat-mode]")]
public class CheatModeTagHelper
[HtmlTargetElement(Attributes = "cheat-mode")]
public class CheatModeTagHelper : TagHelper
{
public CheatModeTagHelper(BTCPayServerOptions env)
{
Env = env;
}
public BTCPayServerOptions Env { get; }
BTCPayServerOptions Env { get; }
public bool CheatMode { get; set; }
public void Process(TagHelperContext context, TagHelperOutput output)
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (Env.CheatMode != CheatMode)
{