mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
Parse enqueued mail message model to object (#1742)
* Parse enqueued mail message model to object The model of an MailQueueMessage is of type object to enable enqueueing of any message. However, this means the we are not able to parse a serialized json object back into the original object. Provide the model type to enable this deserialization * Use ExpandoObject for deserialized queue message model
This commit is contained in:
@ -9,6 +9,6 @@ namespace Bit.Core.Models.Mail
|
||||
IEnumerable<string> BccEmails { get; set; }
|
||||
string Category { get; set; }
|
||||
string TemplateName { get; set; }
|
||||
object Model { get; set; }
|
||||
dynamic Model { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Models.Mail
|
||||
{
|
||||
@ -9,11 +11,12 @@ namespace Bit.Core.Models.Mail
|
||||
public IEnumerable<string> BccEmails { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string TemplateName { get; set; }
|
||||
public object Model { get; set; }
|
||||
[JsonConverter(typeof(ExpandoObjectJsonConverter))]
|
||||
public dynamic Model { get; set; }
|
||||
|
||||
public MailQueueMessage() { }
|
||||
|
||||
public MailQueueMessage(MailMessage message, string templateName, object model)
|
||||
public MailQueueMessage(MailMessage message, string templateName, dynamic model)
|
||||
{
|
||||
Subject = message.Subject;
|
||||
ToEmails = message.ToEmails;
|
||||
|
Reference in New Issue
Block a user