Harden notifications: bump MailKit, bound webhook body, share truncation, skip soft-deleted members
This commit is contained in:
@@ -12,8 +12,6 @@ namespace ROLAC.API.Services.Notifications;
|
||||
/// </summary>
|
||||
public sealed class EmailService : IEmailService
|
||||
{
|
||||
private const int BodyLogMaxLength = 8000;
|
||||
|
||||
private readonly AppDbContext _db;
|
||||
private readonly ISmtpDispatcher _dispatcher;
|
||||
private readonly CurrentUserAccessor _currentUser;
|
||||
@@ -44,7 +42,7 @@ public sealed class EmailService : IEmailService
|
||||
TargetExternalId = recipient.Address,
|
||||
Subject = message.Subject,
|
||||
MemberId = recipient.MemberId,
|
||||
Body = Truncate(message.HtmlBody),
|
||||
Body = NotificationLogText.Truncate(message.HtmlBody),
|
||||
SentByUserId = sentBy,
|
||||
SentAt = DateTime.UtcNow,
|
||||
};
|
||||
@@ -97,6 +95,4 @@ public sealed class EmailService : IEmailService
|
||||
return resolved;
|
||||
}
|
||||
|
||||
private static string Truncate(string body) =>
|
||||
body.Length <= BodyLogMaxLength ? body : body[..BodyLogMaxLength] + "…[truncated]";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user