Only display storage providers that can actually be set in dropdown

This commit is contained in:
rockstardev
2021-04-18 14:03:22 -05:00
parent 99dd6f3e50
commit 04a29ece3b
3 changed files with 13 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BTCPayServer.Abstractions.Extensions;
@@ -19,6 +20,8 @@ using BTCPayServer.Storage.ViewModels;
using BTCPayServer.Views;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Newtonsoft.Json.Linq;
namespace BTCPayServer.Controllers
@@ -175,8 +178,13 @@ namespace BTCPayServer.Controllers
var savedSettings = await _SettingsRepository.GetSettingAsync<StorageSettings>();
if (forceChoice || savedSettings == null)
{
var providersList = _StorageProviderServices.Select(a =>
new SelectListItem(a.StorageProvider().ToString(), a.StorageProvider().ToString())
);
return View(new ChooseStorageViewModel()
{
ProvidersList = providersList,
ShowChangeWarning = savedSettings != null,
Provider = savedSettings?.Provider ?? BTCPayServer.Storage.Models.StorageProvider.FileSystem
});