mirror of
https://github.com/bitwarden/server
synced 2025-12-16 08:13:33 +00:00
[PM-25427] Allow reading mail templates from disk (#6123)
* Allow reading mail templates from self host disk * Update src/Core/Services/Implementations/HandlebarsMailService.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/Core/Services/Implementations/HandlebarsMailService.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * tweak logic * some error handling reading templates from disk * fix: broken test --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Andreas Coroiu <andreas.coroiu@gmail.com>
This commit is contained in:
@@ -23,6 +23,7 @@ public class HandlebarsMailServiceTests
|
||||
private readonly IMailDeliveryService _mailDeliveryService;
|
||||
private readonly IMailEnqueuingService _mailEnqueuingService;
|
||||
private readonly IDistributedCache _distributedCache;
|
||||
private readonly ILogger<HandlebarsMailService> _logger;
|
||||
|
||||
public HandlebarsMailServiceTests()
|
||||
{
|
||||
@@ -30,12 +31,14 @@ public class HandlebarsMailServiceTests
|
||||
_mailDeliveryService = Substitute.For<IMailDeliveryService>();
|
||||
_mailEnqueuingService = Substitute.For<IMailEnqueuingService>();
|
||||
_distributedCache = Substitute.For<IDistributedCache>();
|
||||
_logger = Substitute.For<ILogger<HandlebarsMailService>>();
|
||||
|
||||
_sut = new HandlebarsMailService(
|
||||
_globalSettings,
|
||||
_mailDeliveryService,
|
||||
_mailEnqueuingService,
|
||||
_distributedCache
|
||||
_distributedCache,
|
||||
_logger
|
||||
);
|
||||
}
|
||||
|
||||
@@ -217,8 +220,9 @@ public class HandlebarsMailServiceTests
|
||||
|
||||
var mailDeliveryService = new MailKitSmtpMailDeliveryService(globalSettings, Substitute.For<ILogger<MailKitSmtpMailDeliveryService>>());
|
||||
var distributedCache = Substitute.For<IDistributedCache>();
|
||||
var logger = Substitute.For<ILogger<HandlebarsMailService>>();
|
||||
|
||||
var handlebarsService = new HandlebarsMailService(globalSettings, mailDeliveryService, new BlockingMailEnqueuingService(), distributedCache);
|
||||
var handlebarsService = new HandlebarsMailService(globalSettings, mailDeliveryService, new BlockingMailEnqueuingService(), distributedCache, logger);
|
||||
|
||||
var sendMethods = typeof(IMailService).GetMethods(BindingFlags.Public | BindingFlags.Instance)
|
||||
.Where(m => m.Name.StartsWith("Send") && m.Name != "SendEnqueuedMailMessageAsync");
|
||||
|
||||
Reference in New Issue
Block a user