diff options
Diffstat (limited to 'internal/typeutils/internaltofrontend.go')
| -rw-r--r-- | internal/typeutils/internaltofrontend.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go index 8bd92512a..3c5bd5ca0 100644 --- a/internal/typeutils/internaltofrontend.go +++ b/internal/typeutils/internaltofrontend.go @@ -1391,6 +1391,7 @@ func (c *Converter) baseStatusToFrontend( Emojis: apiEmojis, Card: nil, // TODO: implement cards Text: s.Text, + ContentType: ContentTypeToAPIContentType(s.ContentType), InteractionPolicy: *apiInteractionPolicy, } @@ -1626,6 +1627,17 @@ func (c *Converter) VisToAPIVis(ctx context.Context, m gtsmodel.Visibility) apim return "" } +// Converts a gts status content type into its api equivalent +func ContentTypeToAPIContentType(m gtsmodel.StatusContentType) apimodel.StatusContentType { + switch m { + case gtsmodel.StatusContentTypePlain: + return apimodel.StatusContentTypePlain + case gtsmodel.StatusContentTypeMarkdown: + return apimodel.StatusContentTypeMarkdown + } + return "" +} + // InstanceRuleToAdminAPIRule converts a local instance rule into its api equivalent for serving at /api/v1/admin/instance/rules/:id func InstanceRuleToAPIRule(r gtsmodel.Rule) apimodel.InstanceRule { return apimodel.InstanceRule{ |
