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\nhi @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