Skip to content

Commit

Permalink
move legacy html to mediatypes class
Browse files Browse the repository at this point in the history
  • Loading branch information
oskogstad committed Oct 9, 2024
1 parent 4f3eab0 commit c5f7760
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ internal interface IIgnoreOnAssemblyScan;

internal sealed class ContentValueDtoValidator : AbstractValidator<ContentValueDto>, IIgnoreOnAssemblyScan
{
public const string LegacyHtmlMediaType = "text/html";

public ContentValueDtoValidator(DialogTransmissionContentType contentType)
{
Expand Down Expand Up @@ -74,7 +73,7 @@ private static string[] GetAllowedMediaTypes(DialogContentType contentType, IUse
=> contentType.Id switch
{
DialogContentType.Values.AdditionalInfo when UserHasLegacyHtmlScope(user)
=> contentType.AllowedMediaTypes.Append(LegacyHtmlMediaType).ToArray(),
=> contentType.AllowedMediaTypes.Append(MediaTypes.LegacyHtmlMediaType).ToArray(),
DialogContentType.Values.MainContentReference when UserHasLegacyHtmlScope(user)
=> contentType.AllowedMediaTypes.Append(MediaTypes.LegacyEmbeddableHtml).ToArray(),
_ => contentType.AllowedMediaTypes
Expand Down
1 change: 1 addition & 0 deletions src/Digdir.Domain.Dialogporten.Domain/MediaTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public static class MediaTypes
public const string EmbeddableMarkdown = $"{EmbeddablePrefix}+json;type=markdown";
public const string LegacyEmbeddableHtml = $"{EmbeddablePrefix}+json;type=html";

public const string LegacyHtmlMediaType = "text/html";
public const string Markdown = "text/markdown";
public const string PlainText = "text/plain";
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public async Task Cannot_Create_Transmission_With_Empty_Content_Localization_Val
.Be(2);
}

private const string LegacyHtmlMediaType = ContentValueDtoValidator.LegacyHtmlMediaType;
private const string LegacyHtmlMediaType = MediaTypes.LegacyHtmlMediaType;

private static ContentValueDto CreateHtmlContentValueDto() => new()
{
Expand Down

0 comments on commit c5f7760

Please sign in to comment.