Skip to content

Commit

Permalink
POS: Fix missing store branding property on form error case
Browse files Browse the repository at this point in the history
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 btcpayserver#5655.
  • Loading branch information
dennisreimann committed Jan 12, 2024
1 parent f7542c9 commit 38efbf6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,13 @@ public async Task<IActionResult> POSFormSubmit(string appId, FormViewModel viewM
}
}

var store = await _appService.GetStore(app);
var storeBlob = store.GetStoreBlob();

viewModel.FormName = formData.Name;
viewModel.Form = form;

viewModel.FormParameters = formParameters;
viewModel.StoreBranding = new StoreBrandingViewModel(storeBlob);
return View("Views/UIForms/View", viewModel);
}

Expand Down
2 changes: 1 addition & 1 deletion BTCPayServer/Views/Shared/LayoutHead.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<link href="~/main/site.css" asp-append-version="true" rel="stylesheet" />

<partial name="LayoutHeadTheme" />
@if (ViewData.TryGetValue("StoreBranding", out var storeBranding))
@if (ViewData.TryGetValue("StoreBranding", out var storeBranding) && storeBranding != null)
{
<partial name="LayoutHeadStoreBranding" model="storeBranding" />
}
Expand Down

0 comments on commit 38efbf6

Please sign in to comment.