Fix build warnings and indentation (#4720)

This commit is contained in:
d11n
2023-03-01 02:32:48 +01:00
committed by GitHub
parent 21091cbf1a
commit 2f88da67e8
2 changed files with 18 additions and 19 deletions

View File

@@ -1860,7 +1860,7 @@ namespace BTCPayServer.Tests
})
.ToHashSet();
#pragma warning restore CS0618 // Type or member is obsolete
Assert.Equal(1, formats.Count);
Assert.Single(formats);
}
[Fact]

View File

@@ -1324,15 +1324,15 @@ namespace BTCPayServer.Controllers
public class UpdateLabelsRequest
{
public string Address { get; set; }
public string? Address { get; set; }
public string[]? Labels { get; set; }
}
[HttpPost("{walletId}/update-labels")]
[IgnoreAntiforgeryToken]
public async Task<IActionResult> UpdateLabels( [ModelBinder(typeof(WalletIdModelBinder))] WalletId walletId, [FromBody] UpdateLabelsRequest request)
public async Task<IActionResult> UpdateLabels([ModelBinder(typeof(WalletIdModelBinder))] WalletId walletId, [FromBody] UpdateLabelsRequest request)
{
if (request.Address is null || request.Labels is null)
if (string.IsNullOrEmpty(request.Address) || request.Labels is null)
return BadRequest();
var objid = new WalletObjectId(walletId, WalletObjectData.Types.Address, request.Address);
@@ -1347,8 +1347,7 @@ namespace BTCPayServer.Controllers
var toRemove = currentLabels.Where(data => !request.Labels.Contains(data.Id)).Select(data => data.Id).ToArray();
await WalletRepository.RemoveWalletObjectLabels(objid, toRemove);
}
await
WalletRepository.AddWalletObjectLabels(objid, request.Labels);
await WalletRepository.AddWalletObjectLabels(objid, request.Labels);
return Ok();
}