diff --git a/internal/cache/size.go b/internal/cache/size.go index fbbd2180a..3920a6f19 100644 --- a/internal/cache/size.go +++ b/internal/cache/size.go @@ -695,6 +695,7 @@ func sizeofStatusEdit() uintptr { Content: exampleText, ContentWarning: exampleUsername, // similar length Text: exampleText, + ContentType: gtsmodel.StatusContentTypePlain, Language: "en", Sensitive: func() *bool { ok := false; return &ok }(), AttachmentIDs: []string{exampleID, exampleID, exampleID}, diff --git a/internal/db/bundb/timeline_test.go b/internal/db/bundb/timeline_test.go index 5b3268d36..756ece2d4 100644 --- a/internal/db/bundb/timeline_test.go +++ b/internal/db/bundb/timeline_test.go @@ -45,6 +45,7 @@ func getFutureStatus() *gtsmodel.Status { URL: "http://localhost:8080/@admin/statuses/" + id, Content: "it's the future, wooooooooooooooooooooooooooooooooo", Text: "it's the future, wooooooooooooooooooooooooooooooooo", + ContentType: gtsmodel.StatusContentTypePlain, AttachmentIDs: []string{}, TagIDs: []string{}, MentionIDs: []string{}, diff --git a/internal/processing/status/edit_test.go b/internal/processing/status/edit_test.go index 36ebf2765..c62ea3452 100644 --- a/internal/processing/status/edit_test.go +++ b/internal/processing/status/edit_test.go @@ -90,6 +90,7 @@ func (suite *StatusEditTestSuite) TestSimpleEdit() { previousEdit := latestStatus.Edits[len(latestStatus.Edits)-1] suite.Equal(status.Content, previousEdit.Content) suite.Equal(status.Text, previousEdit.Text) + suite.Equal(status.ContentType, previousEdit.ContentType) suite.Equal(status.ContentWarning, previousEdit.ContentWarning) suite.Equal(*status.Sensitive, *previousEdit.Sensitive) suite.Equal(status.Language, previousEdit.Language) diff --git a/testrig/testmodels.go b/testrig/testmodels.go index 42b2150dc..44eff82fa 100644 --- a/testrig/testmodels.go +++ b/testrig/testmodels.go @@ -1408,6 +1408,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@admin/statuses/01F8MH75CBF9JFX4ZAD54N0W0R", Content: "hello world! #welcome ! first post on the instance :rainbow: !", Text: "hello world! #welcome ! first post on the instance :rainbow: !", + ContentType: gtsmodel.StatusContentTypePlain, AttachmentIDs: []string{"01F8MH6NEM8D7527KZAECTCR76"}, TagIDs: []string{"01F8MHA1A2NF9MJ3WCCQ3K8BSZ"}, MentionIDs: []string{}, @@ -1436,6 +1437,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@admin/statuses/01F8MHAAY43M6RJ473VQFCVH37", Content: "🐕🐕🐕🐕🐕", Text: "🐕🐕🐕🐕🐕", + ContentType: gtsmodel.StatusContentTypePlain, CreatedAt: TimeMustParse("2021-10-20T12:36:45Z"), EditedAt: time.Time{}, Local: util.Ptr(true), @@ -1459,6 +1461,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@admin/statuses/01FF25D5Q0DH7CHD57CTRS6WK0", Content: "hi @the_mighty_zork welcome to the instance!", Text: "hi @the_mighty_zork welcome to the instance!", + ContentType: gtsmodel.StatusContentTypePlain, CreatedAt: TimeMustParse("2021-11-20T13:32:16Z"), EditedAt: time.Time{}, Local: util.Ptr(true), @@ -1506,6 +1509,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@admin/statuses/01J5QVB9VC76NPPRQ207GG4DRZ", Content: `

Hi @1happyturtle, can I reply?

`, Text: "Hi @1happyturtle, can I reply?", + ContentType: gtsmodel.StatusContentTypeMarkdown, CreatedAt: TimeMustParse("2024-02-20T12:41:37+02:00"), EditedAt: time.Time{}, Local: util.Ptr(true), @@ -1531,6 +1535,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY", Content: "hello everyone!", Text: "hello everyone!", + ContentType: gtsmodel.StatusContentTypePlain, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), EditedAt: time.Time{}, Local: util.Ptr(true), @@ -1554,6 +1559,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@the_mighty_zork/statuses/01F8MHAYFKS4KMXF8K5Y1C0KRN", Content: "this is a Public local-only post that shouldn't federate, but it's still boostable, replyable, and likeable", Text: "this is a Public local-only post that shouldn't federate, but it's still boostable, replyable, and likeable", + ContentType: gtsmodel.StatusContentTypePlain, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), EditedAt: time.Time{}, Local: util.Ptr(true), @@ -1577,6 +1583,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@the_mighty_zork/statuses/01F8MHBBN8120SYH7D5S050MGK", Content: "this is a very personal post that I don't want anyone to interact with at all, and i only want mutuals to see it", Text: "this is a very personal post that I don't want anyone to interact with at all, and i only want mutuals to see it", + ContentType: gtsmodel.StatusContentTypePlain, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), EditedAt: time.Time{}, Local: util.Ptr(true), @@ -1611,6 +1618,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@the_mighty_zork/statuses/01F8MH82FYRXD2RC6108DAJ5HB", Content: "here's a little gif of trent.... and also a cow", Text: "here's a little gif of trent.... and also a cow", + ContentType: gtsmodel.StatusContentTypePlain, AttachmentIDs: []string{"01F8MH7TDVANYKWVE8VVKFPJTJ", "01CDR64G398ADCHXK08WWTHEZ5"}, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), EditedAt: time.Time{}, @@ -1635,6 +1643,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@the_mighty_zork/statuses/01FCTA44PW9H1TB328S9AQXKDS", Content: "hi!", Text: "hi!", + ContentType: gtsmodel.StatusContentTypePlain, AttachmentIDs: []string{}, CreatedAt: TimeMustParse("2022-05-20T11:37:55Z"), EditedAt: time.Time{}, @@ -1659,6 +1668,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@the_mighty_zork/statuses/065TKBPE0H2AH8S5X8JCK4XC58", Content: "what do you think of sloths?", Text: "what do you think of sloths?", + ContentType: gtsmodel.StatusContentTypePlain, AttachmentIDs: nil, CreatedAt: TimeMustParse("2022-05-20T11:41:10Z"), EditedAt: time.Time{}, @@ -1684,6 +1694,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@the_mighty_zork/statuses/01HH9KYNQPA416TNJ53NSATP40", Content: "

Here's a bunch of HTML, read it and weep, weep then!

<section class="about-user">\n    <div class="col-header">\n        <h2>About</h2>\n    </div>            \n    <div class="fields">\n        <h3 class="sr-only">Fields</h3>\n        <dl>\n            <div class="field">\n                <dt>should you follow me?</dt>\n                <dd>maybe!</dd>\n            </div>\n            <div class="field">\n                <dt>age</dt>\n                <dd>120</dd>\n            </div>\n        </dl>\n    </div>\n    <div class="bio">\n        <h3 class="sr-only">Bio</h3>\n        <p>i post about things that concern me</p>\n    </div>\n    <div class="sr-only" role="group">\n        <h3 class="sr-only">Stats</h3>\n        <span>Joined in Jun, 2022.</span>\n        <span>8 posts.</span>\n        <span>Followed by 1.</span>\n        <span>Following 1.</span>\n    </div>\n    <div class="accountstats" aria-hidden="true">\n        <b>Joined</b><time datetime="2022-06-04T13:12:00.000Z">Jun, 2022</time>\n        <b>Posts</b><span>8</span>\n        <b>Followed by</b><span>1</span>\n        <b>Following</b><span>1</span>\n    </div>\n</section>\n

There, hope you liked that!

", Text: "Here's a bunch of HTML, read it and weep, weep then!\n\n```html\n
\n
\n

About

\n
\n
\n

Fields

\n
\n
\n
should you follow me?
\n
maybe!
\n
\n
\n
age
\n
120
\n

Stats

\n Joined in Jun, 2022.\n 8 posts.\n Followed by 1.\n Following 1.\n
\n
\n Joined\n Posts8\n Followed by1\n Following1\n
\n
\n```\n\nThere, hope you liked that!", + ContentType: gtsmodel.StatusContentTypeMarkdown, CreatedAt: TimeMustParse("2023-12-10T11:24:00+02:00"), EditedAt: time.Time{}, Local: util.Ptr(true), @@ -1707,6 +1718,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@the_mighty_zork/statuses/01J2M1HPFSS54S60Y0KYV23KJE", Content: "

Thanks! Here's a NIN track

", Text: "Thanks! Here's a NIN track", + ContentType: gtsmodel.StatusContentTypeMarkdown, AttachmentIDs: []string{"01J2M20K6K9XQC4WSB961YJHV6"}, CreatedAt: TimeMustParse("2024-01-10T11:24:00+02:00"), EditedAt: time.Time{}, @@ -1732,6 +1744,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@the_mighty_zork/statuses/01JDPZC707CKDN8N4QVWM4Z1NR", Content: "

this is the latest revision of the status, with a content-warning

", Text: "this is the latest revision of the status, with a content-warning", + ContentType: gtsmodel.StatusContentTypeMarkdown, ContentWarning: "edited status", AttachmentIDs: nil, CreatedAt: TimeMustParse("2024-11-01T11:00:00+02:00"), @@ -1758,6 +1771,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@1happyturtle/statuses/01F8MHBQCBTDKN6X5VHGMMN4MA", Content: "🐢 hi everyone i post about turtles 🐢", Text: "🐢 hi everyone i post about turtles 🐢", + ContentType: gtsmodel.StatusContentTypePlain, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), EditedAt: time.Time{}, Local: util.Ptr(true), @@ -1781,6 +1795,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@1happyturtle/statuses/01F8MHC0H0A7XHTVH5F596ZKBM", Content: "🐢 this one is federated, likeable, and boostable but not replyable 🐢", Text: "🐢 this one is federated, likeable, and boostable but not replyable 🐢", + ContentType: gtsmodel.StatusContentTypePlain, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), EditedAt: time.Time{}, Local: util.Ptr(true), @@ -1815,6 +1830,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@1happyturtle/statuses/01F8MHC8VWDRBQR0N1BATDDEM5", Content: "🐢 i don't mind people sharing and liking this one but I want to moderate replies to it 🐢", Text: "🐢 i don't mind people sharing and liking this one but I want to moderate replies to it 🐢", + ContentType: gtsmodel.StatusContentTypePlain, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), EditedAt: time.Time{}, Local: util.Ptr(true), @@ -1850,6 +1866,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@1happyturtle/statuses/01F8MHCP5P2NWYQ416SBA0XSEV", Content: "🐢 this is a public status but I want it local only and not boostable 🐢", Text: "🐢 this is a public status but I want it local only and not boostable 🐢", + ContentType: gtsmodel.StatusContentTypePlain, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), EditedAt: time.Time{}, Local: util.Ptr(true), @@ -1884,6 +1901,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@1happyturtle/statuses/01FCQSQ667XHJ9AV9T27SJJSX5", Content: "🐢 @the_mighty_zork hi zork! 🐢", Text: "🐢 @the_mighty_zork hi zork! 🐢", + ContentType: gtsmodel.StatusContentTypePlain, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), EditedAt: time.Time{}, Local: util.Ptr(true), @@ -1910,6 +1928,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@1happyturtle/statuses/01FN3VJGFH10KR7S2PB0GFJZYG", Content: "🐢 @the_mighty_zork hi zork, this is a direct message, shhhhhh! 🐢", Text: "🐢 @the_mighty_zork hi zork, this is a direct message, shhhhhh! 🐢", + ContentType: gtsmodel.StatusContentTypePlain, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), EditedAt: time.Time{}, Local: util.Ptr(true), @@ -1937,6 +1956,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@1happyturtle/statuses/01G20ZM733MGN8J344T4ZDDFY1", Content: "🐢 hi followers! did u know i'm a turtle? 🐢", Text: "🐢 hi followers! did u know i'm a turtle? 🐢", + ContentType: gtsmodel.StatusContentTypePlain, AttachmentIDs: []string{}, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), EditedAt: time.Time{}, @@ -1961,6 +1981,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@1happyturtle/statuses/01HEN2PRXT0TF4YDRA64FZZRN7", Content: "hey everyone i got stuck in a shed. any ideas for how to get out?", Text: "hey everyone i got stuck in a shed. any ideas for how to get out?", + ContentType: gtsmodel.StatusContentTypePlain, AttachmentIDs: nil, CreatedAt: TimeMustParse("2021-07-28T10:40:37+02:00"), EditedAt: time.Time{}, @@ -1986,6 +2007,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://localhost:8080/@1happyturtle/statuses/01JDPZEZ77X1NX0TY9M10BK1HM", Content: "

now edited to bring back the previous edit's media!

", Text: "now edited to bring back the previous edit's media!", + ContentType: gtsmodel.StatusContentTypeMarkdown, ContentWarning: "edit with media attachments", AttachmentIDs: []string{"01JDQ164HM08SGJ7ZEK9003Z4B"}, CreatedAt: TimeMustParse("2024-11-01T10:00:00+02:00"), @@ -2087,6 +2109,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URL: "http://fossbros-anonymous.io/@foss_satan/statuses/______", Content: "

this is the latest status edit without poll change

", Text: "this is the latest status edit without poll change", + ContentType: gtsmodel.StatusContentTypeMarkdown, ContentWarning: "", AttachmentIDs: nil, CreatedAt: TimeMustParse("2024-11-01T09:00:00+02:00"), @@ -3617,6 +3640,7 @@ func NewTestStatusEdits() map[string]*gtsmodel.StatusEdit { Content: "

this is the original status

", ContentWarning: "", Text: "this is the original status", + ContentType: gtsmodel.StatusContentTypeMarkdown, Language: "en", Sensitive: util.Ptr(false), AttachmentIDs: nil, @@ -3630,6 +3654,7 @@ func NewTestStatusEdits() map[string]*gtsmodel.StatusEdit { Content: "

this is the first status edit! now with content-warning

", ContentWarning: "edited status", Text: "this is the first status edit! now with content-warning", + ContentType: gtsmodel.StatusContentTypeMarkdown, Language: "en", Sensitive: util.Ptr(false), AttachmentIDs: nil, @@ -3643,6 +3668,7 @@ func NewTestStatusEdits() map[string]*gtsmodel.StatusEdit { Content: "

this is the original status

", ContentWarning: "", Text: "this is the original status", + ContentType: gtsmodel.StatusContentTypeMarkdown, Language: "en", Sensitive: util.Ptr(false), AttachmentIDs: nil, @@ -3656,6 +3682,7 @@ func NewTestStatusEdits() map[string]*gtsmodel.StatusEdit { Content: "

now edited to have some media!

", ContentWarning: "edit with media attachments", Text: "now edited to have some media!", + ContentType: gtsmodel.StatusContentTypeMarkdown, Language: "en", Sensitive: util.Ptr(true), AttachmentIDs: []string{"01JDQ164HM08SGJ7ZEK9003Z4B"}, @@ -3669,6 +3696,7 @@ func NewTestStatusEdits() map[string]*gtsmodel.StatusEdit { Content: "

now edited to remove the media

", ContentWarning: "edit missing previous media attachments", Text: "now edited to remove the media", + ContentType: gtsmodel.StatusContentTypeMarkdown, Language: "en", Sensitive: util.Ptr(false), AttachmentIDs: nil, @@ -3682,6 +3710,7 @@ func NewTestStatusEdits() map[string]*gtsmodel.StatusEdit { Content: "

this is the original status, with a poll!

", ContentWarning: "", Text: "this is the original status, with a poll!", + ContentType: gtsmodel.StatusContentTypeMarkdown, Language: "en", Sensitive: util.Ptr(false), AttachmentIDs: nil, @@ -3695,6 +3724,7 @@ func NewTestStatusEdits() map[string]*gtsmodel.StatusEdit { Content: "

this is the first status edit! now with a different poll!

", ContentWarning: "edited status", Text: "this is the first status edit! now with a different poll!", + ContentType: gtsmodel.StatusContentTypeMarkdown, Language: "en", Sensitive: util.Ptr(false), AttachmentIDs: nil,