Merge branch 'main' into content_warning_fixes

This commit is contained in:
tobi 2025-03-07 10:52:56 +01:00
commit aa5713fc38
26 changed files with 572 additions and 26 deletions

View file

@ -1408,6 +1408,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@admin/statuses/01F8MH75CBF9JFX4ZAD54N0W0R",
Content: "<p>hello world! <a href=\"http://localhost:8080/tags/welcome\" class=\"mention hashtag\" rel=\"tag nofollow noreferrer noopener\" target=\"_blank\">#<span>welcome</span></a> ! first post on the instance :rainbow: !</p>",
Text: "hello world! #welcome ! first post on the instance :rainbow: !",
ContentType: gtsmodel.StatusContentTypePlain,
AttachmentIDs: []string{"01F8MH6NEM8D7527KZAECTCR76"},
TagIDs: []string{"01F8MHA1A2NF9MJ3WCCQ3K8BSZ"},
EmojiIDs: []string{"01F8MH9H8E4VG3KDYJR9EGPXCQ"},
@ -1432,6 +1433,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@admin/statuses/01F8MHAAY43M6RJ473VQFCVH37",
Content: "<p>🐕🐕🐕🐕🐕</p>",
Text: "🐕🐕🐕🐕🐕",
ContentType: gtsmodel.StatusContentTypePlain,
CreatedAt: TimeMustParse("2021-10-20T12:36:45Z"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/admin",
@ -1453,6 +1455,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@admin/statuses/01FF25D5Q0DH7CHD57CTRS6WK0",
Content: "<p>hi <span class=\"h-card\"><a href=\"http://localhost:8080/@1happyturtle\" class=\"u-url mention\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">@<span>the_mighty_zork</span></a></span> welcome to the instance!</p>",
Text: "hi @the_mighty_zork welcome to the instance!",
ContentType: gtsmodel.StatusContentTypePlain,
CreatedAt: TimeMustParse("2021-11-20T13:32:16Z"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/admin",
@ -1493,6 +1496,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@admin/statuses/01J5QVB9VC76NPPRQ207GG4DRZ",
Content: `<p>Hi <span class="h-card"><a href="http://localhost:8080/@1happyturtle" class="u-url mention" rel="nofollow noreferrer noopener" target="_blank">@<span>1happyturtle</span></a></span>, can I reply?</p>`,
Text: "Hi @1happyturtle, can I reply?",
ContentType: gtsmodel.StatusContentTypeMarkdown,
CreatedAt: TimeMustParse("2024-02-20T12:41:37+02:00"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/admin",
@ -1515,6 +1519,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY",
Content: "<p>hello everyone!</p>",
Text: "hello everyone!",
ContentType: gtsmodel.StatusContentTypePlain,
CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/the_mighty_zork",
@ -1535,6 +1540,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@the_mighty_zork/statuses/01F8MHAYFKS4KMXF8K5Y1C0KRN",
Content: "<p>this is a Public local-only post that shouldn't federate, but it's still boostable, replyable, and likeable</p>",
Text: "this is a Public local-only post that shouldn't federate, but it's still boostable, replyable, and likeable",
ContentType: 0,
CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/the_mighty_zork",
@ -1554,6 +1560,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@the_mighty_zork/statuses/01F8MHBBN8120SYH7D5S050MGK",
Content: "<p>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</p>",
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"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/the_mighty_zork",
@ -1585,6 +1592,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@the_mighty_zork/statuses/01F8MH82FYRXD2RC6108DAJ5HB",
Content: "<p>here's a little gif of trent.... and also a cow</p>",
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{},
@ -1607,6 +1615,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@the_mighty_zork/statuses/01FCTA44PW9H1TB328S9AQXKDS",
Content: "<p>hi!</p>",
Text: "hi!",
ContentType: gtsmodel.StatusContentTypePlain,
CreatedAt: TimeMustParse("2022-05-20T11:37:55Z"),
EditedAt: time.Time{},
Local: util.Ptr(true),
@ -1627,6 +1636,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@the_mighty_zork/statuses/065TKBPE0H2AH8S5X8JCK4XC58",
Content: "<p>what do you think of sloths?</p>",
Text: "what do you think of sloths?",
ContentType: gtsmodel.StatusContentTypePlain,
CreatedAt: TimeMustParse("2022-05-20T11:41:10Z"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/the_mighty_zork",
@ -1646,6 +1656,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@the_mighty_zork/statuses/01HH9KYNQPA416TNJ53NSATP40",
Content: "<p>Here's a bunch of HTML, read it and weep, weep then!</p><pre><code class=\"language-html\">&lt;section class=&#34;about-user&#34;&gt;\n &lt;div class=&#34;col-header&#34;&gt;\n &lt;h2&gt;About&lt;/h2&gt;\n &lt;/div&gt; \n &lt;div class=&#34;fields&#34;&gt;\n &lt;h3 class=&#34;sr-only&#34;&gt;Fields&lt;/h3&gt;\n &lt;dl&gt;\n &lt;div class=&#34;field&#34;&gt;\n &lt;dt&gt;should you follow me?&lt;/dt&gt;\n &lt;dd&gt;maybe!&lt;/dd&gt;\n &lt;/div&gt;\n &lt;div class=&#34;field&#34;&gt;\n &lt;dt&gt;age&lt;/dt&gt;\n &lt;dd&gt;120&lt;/dd&gt;\n &lt;/div&gt;\n &lt;/dl&gt;\n &lt;/div&gt;\n &lt;div class=&#34;bio&#34;&gt;\n &lt;h3 class=&#34;sr-only&#34;&gt;Bio&lt;/h3&gt;\n &lt;p&gt;i post about things that concern me&lt;/p&gt;\n &lt;/div&gt;\n &lt;div class=&#34;sr-only&#34; role=&#34;group&#34;&gt;\n &lt;h3 class=&#34;sr-only&#34;&gt;Stats&lt;/h3&gt;\n &lt;span&gt;Joined in Jun, 2022.&lt;/span&gt;\n &lt;span&gt;8 posts.&lt;/span&gt;\n &lt;span&gt;Followed by 1.&lt;/span&gt;\n &lt;span&gt;Following 1.&lt;/span&gt;\n &lt;/div&gt;\n &lt;div class=&#34;accountstats&#34; aria-hidden=&#34;true&#34;&gt;\n &lt;b&gt;Joined&lt;/b&gt;&lt;time datetime=&#34;2022-06-04T13:12:00.000Z&#34;&gt;Jun, 2022&lt;/time&gt;\n &lt;b&gt;Posts&lt;/b&gt;&lt;span&gt;8&lt;/span&gt;\n &lt;b&gt;Followed by&lt;/b&gt;&lt;span&gt;1&lt;/span&gt;\n &lt;b&gt;Following&lt;/b&gt;&lt;span&gt;1&lt;/span&gt;\n &lt;/div&gt;\n&lt;/section&gt;\n</code></pre><p>There, hope you liked that!</p>",
Text: "Here's a bunch of HTML, read it and weep, weep then!\n\n```html\n<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>… <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```\n\nThere, hope you liked that!",
ContentType: gtsmodel.StatusContentTypeMarkdown,
CreatedAt: TimeMustParse("2023-12-10T11:24:00+02:00"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/the_mighty_zork",
@ -1666,6 +1677,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@the_mighty_zork/statuses/01J2M1HPFSS54S60Y0KYV23KJE",
Content: "<p>Thanks! Here's a NIN track</p>",
Text: "Thanks! Here's a NIN track",
ContentType: gtsmodel.StatusContentTypeMarkdown,
AttachmentIDs: []string{"01J2M20K6K9XQC4WSB961YJHV6"},
CreatedAt: TimeMustParse("2024-01-10T11:24:00+02:00"),
Local: util.Ptr(true),
@ -1688,6 +1700,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@the_mighty_zork/statuses/01JDPZC707CKDN8N4QVWM4Z1NR",
Content: "<p>this is the latest revision of the status, with a content-warning</p>",
Text: "this is the latest revision of the status, with a content-warning",
ContentType: gtsmodel.StatusContentTypeMarkdown,
ContentWarning: "edited status",
CreatedAt: TimeMustParse("2024-11-01T11:00:00+02:00"),
EditedAt: TimeMustParse("2024-11-01T11:02:00+02:00"),
@ -1708,6 +1721,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@1happyturtle/statuses/01F8MHBQCBTDKN6X5VHGMMN4MA",
Content: "<p>🐢 hi everyone i post about turtles 🐢</p>",
Text: "🐢 hi everyone i post about turtles 🐢",
ContentType: gtsmodel.StatusContentTypePlain,
CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/1happyturtle",
@ -1728,6 +1742,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@1happyturtle/statuses/01F8MHC0H0A7XHTVH5F596ZKBM",
Content: "<p>🐢 this one is federated, likeable, and boostable but not replyable 🐢</p>",
Text: "🐢 this one is federated, likeable, and boostable but not replyable 🐢",
ContentType: gtsmodel.StatusContentTypePlain,
CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/1happyturtle",
@ -1758,6 +1773,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@1happyturtle/statuses/01F8MHC8VWDRBQR0N1BATDDEM5",
Content: "<p>🐢 i don't mind people sharing and liking this one but I want to moderate replies to it 🐢</p>",
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"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/1happyturtle",
@ -1790,6 +1806,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@1happyturtle/statuses/01F8MHCP5P2NWYQ416SBA0XSEV",
Content: "<p>🐢 this is a public status but I want it local only and not boostable 🐢</p>",
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"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/1happyturtle",
@ -1820,6 +1837,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@1happyturtle/statuses/01FCQSQ667XHJ9AV9T27SJJSX5",
Content: "<p>🐢 <span class=\"h-card\"><a href=\"http://localhost:8080/@1happyturtle\" class=\"u-url mention\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">@<span>the_mighty_zork</span></a></span> hi zork! 🐢</p>",
Text: "🐢 @the_mighty_zork hi zork! 🐢",
ContentType: gtsmodel.StatusContentTypePlain,
CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/1happyturtle",
@ -1843,6 +1861,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@1happyturtle/statuses/01FN3VJGFH10KR7S2PB0GFJZYG",
Content: "<p>🐢 <span class=\"h-card\"><a href=\"http://localhost:8080/@1happyturtle\" class=\"u-url mention\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">@<span>the_mighty_zork</span></a></span> hi zork, this is a direct message, shhhhhh! 🐢</p>",
Text: "🐢 @the_mighty_zork hi zork, this is a direct message, shhhhhh! 🐢",
ContentType: gtsmodel.StatusContentTypePlain,
CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/1happyturtle",
@ -1864,6 +1883,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@1happyturtle/statuses/01G20ZM733MGN8J344T4ZDDFY1",
Content: "<p>🐢 hi followers! did u know i'm a turtle? 🐢</p>",
Text: "🐢 hi followers! did u know i'm a turtle? 🐢",
ContentType: gtsmodel.StatusContentTypePlain,
CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"),
EditedAt: time.Time{},
Local: util.Ptr(true),
@ -1884,6 +1904,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@1happyturtle/statuses/01HEN2PRXT0TF4YDRA64FZZRN7",
Content: "<p>hey everyone i got stuck in a shed. any ideas for how to get out?</p>",
Text: "hey everyone i got stuck in a shed. any ideas for how to get out?",
ContentType: gtsmodel.StatusContentTypePlain,
CreatedAt: TimeMustParse("2021-07-28T10:40:37+02:00"),
EditedAt: time.Time{},
Local: util.Ptr(true),
@ -1904,6 +1925,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://localhost:8080/@1happyturtle/statuses/01JDPZEZ77X1NX0TY9M10BK1HM",
Content: "<p>now edited to bring back the previous edit's media!</p>",
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"),
@ -1978,6 +2000,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
URL: "http://fossbros-anonymous.io/@foss_satan/statuses/______",
Content: "<p>this is the latest status edit without poll change</p>",
Text: "this is the latest status edit without poll change",
ContentType: gtsmodel.StatusContentTypeMarkdown,
CreatedAt: TimeMustParse("2024-11-01T09:00:00+02:00"),
EditedAt: TimeMustParse("2024-11-01T09:02:00+02:00"),
Local: util.Ptr(false),
@ -3494,38 +3517,42 @@ func NewTestInteractionRequests() map[string]*gtsmodel.InteractionRequest {
func NewTestStatusEdits() map[string]*gtsmodel.StatusEdit {
return map[string]*gtsmodel.StatusEdit{
"local_account_1_status_9_edit_1": {
ID: "01JDPZCZ2Y9KSGZW0R7ZG8T8Y2",
Content: "<p>this is the original status</p>",
Text: "this is the original status",
Language: "en",
Sensitive: util.Ptr(false),
StatusID: "01JDPZC707CKDN8N4QVWM4Z1NR",
CreatedAt: TimeMustParse("2024-11-01T11:00:00+02:00"),
ID: "01JDPZCZ2Y9KSGZW0R7ZG8T8Y2",
Content: "<p>this is the original status</p>",
Text: "this is the original status",
ContentType: gtsmodel.StatusContentTypeMarkdown,
Language: "en",
Sensitive: util.Ptr(false),
StatusID: "01JDPZC707CKDN8N4QVWM4Z1NR",
CreatedAt: TimeMustParse("2024-11-01T11:00:00+02:00"),
},
"local_account_1_status_9_edit_2": {
ID: "01JDPZDADMD1T9HKF94RECF7PP",
Content: "<p>this is the first status edit! now with content-warning</p>",
ContentWarning: "edited status",
Text: "this is the first status edit! now with content-warning",
ContentType: gtsmodel.StatusContentTypeMarkdown,
Language: "en",
Sensitive: util.Ptr(false),
StatusID: "01JDPZC707CKDN8N4QVWM4Z1NR",
CreatedAt: TimeMustParse("2024-11-01T11:01:00+02:00"),
},
"local_account_2_status_9_edit_1": {
ID: "01JDPZPBXAX0M02YSEPB21KX4R",
Content: "<p>this is the original status</p>",
Text: "this is the original status",
Language: "en",
Sensitive: util.Ptr(false),
StatusID: "01JDPZEZ77X1NX0TY9M10BK1HM",
CreatedAt: TimeMustParse("2024-11-01T10:00:00+02:00"),
ID: "01JDPZPBXAX0M02YSEPB21KX4R",
Content: "<p>this is the original status</p>",
Text: "this is the original status",
ContentType: gtsmodel.StatusContentTypeMarkdown,
Language: "en",
Sensitive: util.Ptr(false),
StatusID: "01JDPZEZ77X1NX0TY9M10BK1HM",
CreatedAt: TimeMustParse("2024-11-01T10:00:00+02:00"),
},
"local_account_2_status_9_edit_2": {
ID: "01JDPZPJHKP7E3M0YQXEXPS1YT",
Content: "<p>now edited to have some media!</p>",
ContentWarning: "edit with media attachments",
Text: "now edited to have some media!",
ContentType: gtsmodel.StatusContentTypeMarkdown,
Language: "en",
Sensitive: util.Ptr(true),
AttachmentIDs: []string{"01JDQ164HM08SGJ7ZEK9003Z4B"},
@ -3537,6 +3564,7 @@ func NewTestStatusEdits() map[string]*gtsmodel.StatusEdit {
Content: "<p>now edited to remove the media</p>",
ContentWarning: "edit missing previous media attachments",
Text: "now edited to remove the media",
ContentType: gtsmodel.StatusContentTypeMarkdown,
Language: "en",
Sensitive: util.Ptr(false),
StatusID: "01JDPZEZ77X1NX0TY9M10BK1HM",
@ -3546,6 +3574,7 @@ func NewTestStatusEdits() map[string]*gtsmodel.StatusEdit {
ID: "01JDQ07ZZ4FGP13YN8TF63P5A6",
Content: "<p>this is the original status, with a poll!</p>",
Text: "this is the original status, with a poll!",
ContentType: gtsmodel.StatusContentTypeMarkdown,
Language: "en",
Sensitive: util.Ptr(false),
PollOptions: []string{"yes", "no", "spiderman"},
@ -3558,6 +3587,7 @@ func NewTestStatusEdits() map[string]*gtsmodel.StatusEdit {
Content: "<p>this is the first status edit! now with a different poll!</p>",
ContentWarning: "edited status",
Text: "this is the first status edit! now with a different poll!",
ContentType: gtsmodel.StatusContentTypeMarkdown,
Language: "en",
Sensitive: util.Ptr(false),
PollOptions: []string{"yes", "no", "maybe", "i don't know", "can you repeat the question"},