POS: Fix missing store branding property on form error case (#5658)

When a POS has a form, which results in an error state, the store branding property was not set. This adds the missing property and also does not render the store branding partial, in case the model property isn't present.

Fixes #5655.
This commit is contained in:
d11n 2024-01-16 08:55:38 +01:00 committed by GitHub
parent 89d294524a
commit 70e9ea1d5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -516,10 +516,13 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers
} }
} }
var store = await _appService.GetStore(app);
var storeBlob = store.GetStoreBlob();
viewModel.FormName = formData.Name; viewModel.FormName = formData.Name;
viewModel.Form = form; viewModel.Form = form;
viewModel.FormParameters = formParameters; viewModel.FormParameters = formParameters;
viewModel.StoreBranding = new StoreBrandingViewModel(storeBlob);
return View("Views/UIForms/View", viewModel); return View("Views/UIForms/View", viewModel);
} }

View file

@ -15,7 +15,7 @@
<link href="~/main/site.css" asp-append-version="true" rel="stylesheet" /> <link href="~/main/site.css" asp-append-version="true" rel="stylesheet" />
<partial name="LayoutHeadTheme" /> <partial name="LayoutHeadTheme" />
@if (ViewData.TryGetValue("StoreBranding", out var storeBranding)) @if (ViewData.TryGetValue("StoreBranding", out var storeBranding) && storeBranding != null)
{ {
<partial name="LayoutHeadStoreBranding" model="storeBranding" /> <partial name="LayoutHeadStoreBranding" model="storeBranding" />
} }