From cd53543ec13223c7b622fee321f1c1ade8882ed6 Mon Sep 17 00:00:00 2001 From: ewin Date: Mon, 3 Mar 2025 16:42:04 -0500 Subject: [PATCH] ensure ContentType is updated anywhere Text is --- internal/cache/size.go | 1 + internal/federation/dereferencing/status.go | 1 + internal/processing/status/create.go | 4 +--- internal/processing/status/edit.go | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/cache/size.go b/internal/cache/size.go index 1c8c5fe2e..fbbd2180a 100644 --- a/internal/cache/size.go +++ b/internal/cache/size.go @@ -649,6 +649,7 @@ func sizeofStatus() uintptr { URL: exampleURI, Content: exampleText, Text: exampleText, + ContentType: gtsmodel.StatusContentTypePlain, AttachmentIDs: []string{exampleID, exampleID, exampleID}, TagIDs: []string{exampleID, exampleID, exampleID}, MentionIDs: []string{}, diff --git a/internal/federation/dereferencing/status.go b/internal/federation/dereferencing/status.go index 8ebfe6431..2718187cf 100644 --- a/internal/federation/dereferencing/status.go +++ b/internal/federation/dereferencing/status.go @@ -1239,6 +1239,7 @@ func (d *Dereferencer) handleStatusEdit( edit.Content = existing.Content edit.ContentWarning = existing.ContentWarning edit.Text = existing.Text + edit.ContentType = existing.ContentType edit.Language = existing.Language edit.Sensitive = existing.Sensitive edit.StatusID = status.ID diff --git a/internal/processing/status/create.go b/internal/processing/status/create.go index c1a93d594..c2c2da675 100644 --- a/internal/processing/status/create.go +++ b/internal/processing/status/create.go @@ -170,13 +170,11 @@ func (p *Processor) Create( // Set validated language. Language: content.Language, - // Set resolved content type. - ContentType: typeutils.APIContentTypeToContentType(contentType), - // Set formatted status content. Content: content.Content, ContentWarning: content.ContentWarning, Text: form.Status, // raw + ContentType: typeutils.APIContentTypeToContentType(contentType), // Set gathered mentions. MentionIDs: content.MentionIDs, diff --git a/internal/processing/status/edit.go b/internal/processing/status/edit.go index 9d7821588..f7547ebc0 100644 --- a/internal/processing/status/edit.go +++ b/internal/processing/status/edit.go @@ -303,6 +303,7 @@ func (p *Processor) Edit( status.Content = content.Content status.ContentWarning = content.ContentWarning status.Text = form.Status + status.ContentType = typeutils.APIContentTypeToContentType(form.ContentType) status.Language = content.Language status.Sensitive = &form.Sensitive status.AttachmentIDs = form.MediaIDs