Fix email settings on store level, when server has no email settings (#6080)

* Fix email settings on store level, when server has no email settings

Fixes #6076.

* docker-compose: Add missing restart for merchant CLN container
This commit is contained in:
d11n 2024-07-09 15:51:16 +02:00 committed by Dennis Reimann
parent f03ea5c115
commit a46073f3e4
No known key found for this signature in database
GPG Key ID: 5009E1797F03F8D0
3 changed files with 4 additions and 2 deletions

View File

@ -2919,7 +2919,7 @@ namespace BTCPayServer.Tests
Password = "store@store.com",
Port = 1234,
Server = "store.com"
}), "", true));
}), ""));
Assert.Equal("store@store.com", (await Assert.IsType<StoreEmailSender>(await emailSenderFactory.GetEmailSender(acc.StoreId)).GetEmailSettings()).Login);
}

View File

@ -195,10 +195,11 @@ public partial class UIStoresController
if (store == null)
return NotFound();
ViewBag.UseCustomSMTP = useCustomSMTP;
model.FallbackSettings = await _emailSenderFactory.GetEmailSender(store.Id) is StoreEmailSender { FallbackSender: not null } storeSender
? await storeSender.FallbackSender.GetEmailSettings()
: null;
if (model.FallbackSettings is null) useCustomSMTP = true;
ViewBag.UseCustomSMTP = useCustomSMTP;
if (useCustomSMTP)
{
model.Settings.Validate("Settings.", ModelState);

View File

@ -29,6 +29,7 @@
}
else
{
<input type="hidden" name="UseCustomSMTP" value="true" />
<partial name="EmailsBody" model="Model" />
}