From c013892ca22fe6bface8dc580571b2f0527cd1db Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Wed, 8 Jan 2025 10:29:23 +0000 Subject: [chore] replace statuses.updated_at column with statuses.edited_at (#3636) * update statuses table to replace updated_at column with edited_at * code comment * better code comments, fix setting of status + edit + mention + poll database times * fix log to logf call * fix status.EditIDs not being carried over in dereferencer.encrichStatus() * move status.EditID setting into handleStatusEdit() --- testrig/testmodels.go | 56 +++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'testrig/testmodels.go') diff --git a/testrig/testmodels.go b/testrig/testmodels.go index 2b83c2102..81c3a85c5 100644 --- a/testrig/testmodels.go +++ b/testrig/testmodels.go @@ -1432,7 +1432,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { MentionIDs: []string{}, EmojiIDs: []string{"01F8MH9H8E4VG3KDYJR9EGPXCQ"}, CreatedAt: TimeMustParse("2021-10-20T11:36:45Z"), - UpdatedAt: TimeMustParse("2021-10-20T11:36:45Z"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/admin", AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", @@ -1456,7 +1456,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Content: "🐕🐕🐕🐕🐕", Text: "🐕🐕🐕🐕🐕", CreatedAt: TimeMustParse("2021-10-20T12:36:45Z"), - UpdatedAt: TimeMustParse("2021-10-20T12:36:45Z"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/admin", AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", @@ -1479,7 +1479,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Content: "hi @the_mighty_zork welcome to the instance!", Text: "hi @the_mighty_zork welcome to the instance!", CreatedAt: TimeMustParse("2021-11-20T13:32:16Z"), - UpdatedAt: TimeMustParse("2021-11-20T13:32:16Z"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/admin", MentionIDs: []string{"01FF26A6BGEKCZFWNEHXB2ZZ6M"}, @@ -1502,7 +1502,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { URI: "http://localhost:8080/users/admin/statuses/01G36SF3V6Y6V5BF9P4R7PQG7G", URL: "http://localhost:8080/@admin/statuses/01G36SF3V6Y6V5BF9P4R7PQG7G", CreatedAt: TimeMustParse("2021-10-20T12:41:37+02:00"), - UpdatedAt: TimeMustParse("2021-10-20T12:41:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/admin", AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", @@ -1526,7 +1526,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Content: `

Hi @1happyturtle, can I reply?

`, Text: "Hi @1happyturtle, can I reply?", CreatedAt: TimeMustParse("2024-02-20T12:41:37+02:00"), - UpdatedAt: TimeMustParse("2024-02-20T12:41:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/admin", MentionIDs: []string{"01J5QVP69ANF1K4WHES6GA4WXP"}, @@ -1551,7 +1551,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Content: "hello everyone!", Text: "hello everyone!", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", @@ -1574,7 +1574,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { 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", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", @@ -1597,7 +1597,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { 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", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", @@ -1632,7 +1632,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "here's a little gif of trent.... and also a cow", AttachmentIDs: []string{"01F8MH7TDVANYKWVE8VVKFPJTJ", "01CDR64G398ADCHXK08WWTHEZ5"}, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", @@ -1656,7 +1656,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "hi!", AttachmentIDs: []string{}, CreatedAt: TimeMustParse("2022-05-20T11:37:55Z"), - UpdatedAt: TimeMustParse("2022-05-20T11:37:55Z"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", @@ -1680,7 +1680,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "what do you think of sloths?", AttachmentIDs: nil, CreatedAt: TimeMustParse("2022-05-20T11:41:10Z"), - UpdatedAt: TimeMustParse("2022-05-20T11:41:10Z"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", @@ -1704,7 +1704,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { 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!", CreatedAt: TimeMustParse("2023-12-10T11:24:00+02:00"), - UpdatedAt: TimeMustParse("2023-12-10T11:24:00+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", @@ -1728,7 +1728,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "Thanks! Here's a NIN track", AttachmentIDs: []string{"01J2M20K6K9XQC4WSB961YJHV6"}, CreatedAt: TimeMustParse("2024-01-10T11:24:00+02:00"), - UpdatedAt: TimeMustParse("2024-01-10T11:24:00+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", @@ -1754,7 +1754,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { ContentWarning: "edited status", AttachmentIDs: nil, CreatedAt: TimeMustParse("2024-11-01T11:00:00+02:00"), - UpdatedAt: TimeMustParse("2024-11-01T11:02:00+02:00"), + EditedAt: TimeMustParse("2024-11-01T11:02:00+02:00"), Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", @@ -1778,7 +1778,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Content: "🐢 hi everyone i post about turtles 🐢", Text: "🐢 hi everyone i post about turtles 🐢", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", @@ -1801,7 +1801,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Content: "🐢 this one is federated, likeable, and boostable but not replyable 🐢", Text: "🐢 this one is federated, likeable, and boostable but not replyable 🐢", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", @@ -1835,7 +1835,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { 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 🐢", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", @@ -1870,7 +1870,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { 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 🐢", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", @@ -1904,7 +1904,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Content: "🐢 @the_mighty_zork hi zork! 🐢", Text: "🐢 @the_mighty_zork hi zork! 🐢", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", MentionIDs: []string{"01FDF2HM2NF6FSRZCDEDV451CN"}, @@ -1930,7 +1930,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Content: "🐢 @the_mighty_zork hi zork, this is a direct message, shhhhhh! 🐢", Text: "🐢 @the_mighty_zork hi zork, this is a direct message, shhhhhh! 🐢", CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", MentionIDs: []string{"01FDF2HM2NF6FSRZCDEDV451CN"}, @@ -1958,7 +1958,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "🐢 hi followers! did u know i'm a turtle? 🐢", AttachmentIDs: []string{}, CreatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-10-20T12:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", @@ -1982,7 +1982,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Text: "hey everyone i got stuck in a shed. any ideas for how to get out?", AttachmentIDs: nil, CreatedAt: TimeMustParse("2021-07-28T10:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-07-28T10:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/1happyturtle", AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", @@ -2008,7 +2008,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { ContentWarning: "edit with media attachments", AttachmentIDs: []string{"01JDQ164HM08SGJ7ZEK9003Z4B"}, CreatedAt: TimeMustParse("2024-11-01T10:00:00+02:00"), - UpdatedAt: TimeMustParse("2024-11-01T10:03:00+02:00"), + EditedAt: TimeMustParse("2024-11-01T10:03:00+02:00"), Local: util.Ptr(true), AccountURI: "http://localhost:8080/users/the_mighty_zork", AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", @@ -2032,7 +2032,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Content: "dark souls status bot: \"thoughts of dog\"", AttachmentIDs: []string{"01FVW7RXPQ8YJHTEXYPE7Q8ZY0"}, CreatedAt: TimeMustParse("2021-09-20T12:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-09-20T12:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(false), AccountURI: "http://fossbros-anonymous.io/users/foss_satan", MentionIDs: []string{}, @@ -2057,7 +2057,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Content: "what products should i buy at the grocery store?", AttachmentIDs: []string{"01FVW7RXPQ8YJHTEXYPE7Q8ZY0"}, CreatedAt: TimeMustParse("2021-09-11T11:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-09-11T11:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(false), AccountURI: "http://fossbros-anonymous.io/users/foss_satan", AccountID: "01F8MH5ZK5VRH73AKHQM6Y9VNX", @@ -2082,7 +2082,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Content: "what products should i buy at the grocery store? (now an endless poll!)", AttachmentIDs: []string{"01FVW7RXPQ8YJHTEXYPE7Q8ZY0"}, CreatedAt: TimeMustParse("2021-09-11T11:40:37+02:00"), - UpdatedAt: TimeMustParse("2021-09-11T11:40:37+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(false), AccountURI: "http://fossbros-anonymous.io/users/foss_satan", AccountID: "01F8MH5ZK5VRH73AKHQM6Y9VNX", @@ -2109,7 +2109,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { ContentWarning: "", AttachmentIDs: nil, CreatedAt: TimeMustParse("2024-11-01T09:00:00+02:00"), - UpdatedAt: TimeMustParse("2024-11-01T09:02:00+02:00"), + EditedAt: TimeMustParse("2024-11-01T09:02:00+02:00"), Local: util.Ptr(false), AccountURI: "http://fossbros-anonymous.io/users/foss_satan", AccountID: "01F8MH5ZK5VRH73AKHQM6Y9VNX", @@ -2134,7 +2134,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { Content: `

hi @admin here's some media for ya

`, AttachmentIDs: []string{"01HE7Y3C432WRSNS10EZM86SA5", "01HE7ZFX9GKA5ZZVD4FACABSS9", "01HE88YG74PVAB81PX2XA9F3FG"}, CreatedAt: TimeMustParse("2023-11-02T12:44:25+02:00"), - UpdatedAt: TimeMustParse("2023-11-02T12:44:25+02:00"), + EditedAt: time.Time{}, Local: util.Ptr(false), AccountURI: "http://example.org/users/Some_User", MentionIDs: []string{"01HE7XQNMKTVC8MNPCE1JGK4J3"}, -- cgit v1.2.3