Skip to content

Commit

Permalink
Message: fixed serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelbannov committed Dec 13, 2023
1 parent fbf12d5 commit aba68fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions common/ASC.MessagingSystem/Core/MessageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode

using System.Text.Json.Serialization;

namespace ASC.MessagingSystem.Core;

[Scope]
Expand Down Expand Up @@ -278,13 +280,19 @@ private bool TryAddNotificationParam(MessageAction action, List<Guid> userIds, o
{
UserIds = userIds,
UserRole = (int)userType
}, new JsonSerializerOptions
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
});
}
else if (action is MessageAction.UserCreated or MessageAction.UserUpdated)
{
parametr = JsonSerializer.Serialize(new AdditionalNotificationInfo
{
UserIds = userIds
}, new JsonSerializerOptions
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
});
}
else
Expand Down
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/Helpers/FilesMessageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public async Task SendAsync<T>(MessageAction action, FileEntry<T> entry, Message
_ => string.Empty
};

var serializedParam = JsonSerializer.Serialize(info);
var serializedParam = JsonSerializer.Serialize(info, new JsonSerializerOptions{ DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull });

return serializedParam;
}
Expand Down

0 comments on commit aba68fd

Please sign in to comment.