Fix link from app label (#2028)

This commit is contained in:
Andrew Camilleri 2020-11-02 12:26:11 +01:00 committed by GitHub
parent 793b1b56d9
commit d2910686cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -41,12 +41,13 @@ namespace BTCPayServer.Controllers
[HttpGet("/apps/{appId}")]
public async Task<IActionResult> RedirectToApp(string appId)
{
switch (await _AppService.GetAppInfo(appId))
switch ((await _AppService.GetApp(appId, null)).AppType)
{
case ViewCrowdfundViewModel _:
case nameof(AppType.Crowdfund):
return RedirectToAction("ViewCrowdfund", new {appId});
case ViewPointOfSaleViewModel _:
case nameof(AppType.PointOfSale):
return RedirectToAction("ViewPointOfSale", new {appId});
}

View File

@ -248,13 +248,13 @@ namespace BTCPayServer.Services.Apps
}
}
public async Task<AppData> GetApp(string appId, AppType appType, bool includeStore = false)
public async Task<AppData> GetApp(string appId, AppType? appType, bool includeStore = false)
{
using (var ctx = _ContextFactory.CreateContext())
{
var query = ctx.Apps
.Where(us => us.Id == appId &&
us.AppType == appType.ToString());
(appType == null || us.AppType == appType.ToString()));
if (includeStore)
{