summaryrefslogtreecommitdiff
path: root/internal/api
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-12-05 13:35:07 +0000
committerLibravatar GitHub <noreply@github.com>2024-12-05 13:35:07 +0000
commit23fc70f4e68730b7eec91d58dac54ec00099ed8d (patch)
tree9ab22b85d1d2c9c7ff2db9371ab2dc752c085f07 /internal/api
parent[feature] unending polls (#3592) (diff)
downloadgotosocial-23fc70f4e68730b7eec91d58dac54ec00099ed8d.tar.xz
[feature] add support for receiving federated status edits (#3597)
* add support for extracting Updated field from Statusable implementers * add support for status edits in the database, and update status dereferencer to handle them * remove unused AdditionalInfo{}.CreatedAt * remove unused AdditionalEmojiInfo{}.CreatedAt * update new mention creation to use status.UpdatedAt * remove mention.UpdatedAt, fixes related to NewULIDFromTime() change * add migration to remove Mention{}.UpdatedAt field * add migration to add the StatusEdit{} table * start adding tests, add delete function for status edits * add more of status edit migrations, fill in more of the necessary edit delete functionality * remove unused function * allow generating gotosocial compatible ulid via CLI with `go run ./cmd/gen-ulid` * add StatusEdit{} test models * fix new statusedits sql * use model instead of table name * actually remove the Mention.UpdatedAt field... * fix tests now new models are added, add more status edit DB tests * fix panic wording * add test for deleting status edits * don't automatically set `updated_at` field on updated statuses * flesh out more of the dereferencer status edit tests, ensure updated at field set on outgoing AS statuses * remove media_attachments.updated_at column * fix up more tests, further complete the dereferencer status edit tests * update more status serialization tests not expecting 'updated' AS property * gah!! json serialization tests!! * undo some gtscontext wrapping changes * more serialization test fixing :smiling_face_with_tear: * more test fixing, ensure the edit.status_id field is actually set :facepalm: * fix status edit test * grrr linter * add edited_at field to apimodel status * remove the choice of paging on the timeline public filtered test (otherwise it needs updating every time you add statuses ...) * ensure that status.updated_at always fits chronologically * fix more serialization tests ... * add more code comments * fix envparsing * update swagger file * properly handle media description changes during status edits * slight formatting tweak * code comment
Diffstat (limited to 'internal/api')
-rw-r--r--internal/api/activitypub/users/outboxget_test.go16
-rw-r--r--internal/api/client/accounts/accountverify_test.go2
-rw-r--r--internal/api/client/admin/accountsgetv2_test.go12
-rw-r--r--internal/api/client/admin/reportsget_test.go47
-rw-r--r--internal/api/client/exports/exports_test.go2
-rw-r--r--internal/api/client/instance/instancepatch_test.go12
-rw-r--r--internal/api/client/mutes/mutesget_test.go2
-rw-r--r--internal/api/client/reports/reportget_test.go4
-rw-r--r--internal/api/client/reports/reportsget_test.go16
-rw-r--r--internal/api/client/search/searchget_test.go6
-rw-r--r--internal/api/client/statuses/statusboost_test.go6
-rw-r--r--internal/api/client/statuses/statuscreate_test.go12
-rw-r--r--internal/api/client/statuses/statusfave_test.go2
-rw-r--r--internal/api/client/statuses/statushistory_test.go4
-rw-r--r--internal/api/client/statuses/statusmute_test.go10
-rw-r--r--internal/api/model/content.go3
-rw-r--r--internal/api/model/status.go4
17 files changed, 97 insertions, 63 deletions
diff --git a/internal/api/activitypub/users/outboxget_test.go b/internal/api/activitypub/users/outboxget_test.go
index cba1ef31d..2de3b0456 100644
--- a/internal/api/activitypub/users/outboxget_test.go
+++ b/internal/api/activitypub/users/outboxget_test.go
@@ -82,7 +82,7 @@ func (suite *OutboxGetTestSuite) TestGetOutbox() {
"@context": "https://www.w3.org/ns/activitystreams",
"first": "http://localhost:8080/users/the_mighty_zork/outbox?limit=40",
"id": "http://localhost:8080/users/the_mighty_zork/outbox",
- "totalItems": 8,
+ "totalItems": 9,
"type": "OrderedCollection"
}`, dst.String())
@@ -145,6 +145,14 @@ func (suite *OutboxGetTestSuite) TestGetOutboxFirstPage() {
{
"actor": "http://localhost:8080/users/the_mighty_zork",
"cc": "http://localhost:8080/users/the_mighty_zork/followers",
+ "id": "http://localhost:8080/users/the_mighty_zork/statuses/01JDPZC707CKDN8N4QVWM4Z1NR/activity#Create",
+ "object": "http://localhost:8080/users/the_mighty_zork/statuses/01JDPZC707CKDN8N4QVWM4Z1NR",
+ "to": "https://www.w3.org/ns/activitystreams#Public",
+ "type": "Create"
+ },
+ {
+ "actor": "http://localhost:8080/users/the_mighty_zork",
+ "cc": "http://localhost:8080/users/the_mighty_zork/followers",
"id": "http://localhost:8080/users/the_mighty_zork/statuses/01HH9KYNQPA416TNJ53NSATP40/activity#Create",
"object": "http://localhost:8080/users/the_mighty_zork/statuses/01HH9KYNQPA416TNJ53NSATP40",
"to": "https://www.w3.org/ns/activitystreams#Public",
@@ -160,8 +168,8 @@ func (suite *OutboxGetTestSuite) TestGetOutboxFirstPage() {
}
],
"partOf": "http://localhost:8080/users/the_mighty_zork/outbox",
- "prev": "http://localhost:8080/users/the_mighty_zork/outbox?limit=40\u0026min_id=01HH9KYNQPA416TNJ53NSATP40",
- "totalItems": 8,
+ "prev": "http://localhost:8080/users/the_mighty_zork/outbox?limit=40\u0026min_id=01JDPZC707CKDN8N4QVWM4Z1NR",
+ "totalItems": 9,
"type": "OrderedCollectionPage"
}`, dst.String())
@@ -224,7 +232,7 @@ func (suite *OutboxGetTestSuite) TestGetOutboxNextPage() {
"id": "http://localhost:8080/users/the_mighty_zork/outbox?limit=40&max_id=01F8MHAMCHF6Y650WCRSCP4WMY",
"orderedItems": [],
"partOf": "http://localhost:8080/users/the_mighty_zork/outbox",
- "totalItems": 8,
+ "totalItems": 9,
"type": "OrderedCollectionPage"
}`, dst.String())
diff --git a/internal/api/client/accounts/accountverify_test.go b/internal/api/client/accounts/accountverify_test.go
index 3f67cdefb..df5c21389 100644
--- a/internal/api/client/accounts/accountverify_test.go
+++ b/internal/api/client/accounts/accountverify_test.go
@@ -97,7 +97,7 @@ func (suite *AccountVerifyTestSuite) TestAccountVerifyGet() {
suite.Equal("http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.webp", apimodelAccount.HeaderStatic)
suite.Equal(2, apimodelAccount.FollowersCount)
suite.Equal(2, apimodelAccount.FollowingCount)
- suite.Equal(8, apimodelAccount.StatusesCount)
+ suite.Equal(9, apimodelAccount.StatusesCount)
suite.EqualValues(apimodel.VisibilityPublic, apimodelAccount.Source.Privacy)
suite.Equal(testAccount.Settings.Language, apimodelAccount.Source.Language)
suite.Equal(testAccount.NoteRaw, apimodelAccount.Source.Note)
diff --git a/internal/api/client/admin/accountsgetv2_test.go b/internal/api/client/admin/accountsgetv2_test.go
index 77ca135eb..489a245d0 100644
--- a/internal/api/client/admin/accountsgetv2_test.go
+++ b/internal/api/client/admin/accountsgetv2_test.go
@@ -99,8 +99,8 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() {
"header_description": "Flat gray background (default header).",
"followers_count": 1,
"following_count": 1,
- "statuses_count": 8,
- "last_status_at": "2021-07-28",
+ "statuses_count": 9,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": [
{
@@ -262,8 +262,8 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() {
"header_media_id": "01PFPMWK2FF0D9WMHEJHR07C3Q",
"followers_count": 2,
"following_count": 2,
- "statuses_count": 8,
- "last_status_at": "2024-01-10",
+ "statuses_count": 9,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": [],
"enable_rss": true
@@ -403,8 +403,8 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() {
"header_description": "Flat gray background (default header).",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 3,
- "last_status_at": "2021-09-11",
+ "statuses_count": 4,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": []
}
diff --git a/internal/api/client/admin/reportsget_test.go b/internal/api/client/admin/reportsget_test.go
index 12a307836..255e32c3b 100644
--- a/internal/api/client/admin/reportsget_test.go
+++ b/internal/api/client/admin/reportsget_test.go
@@ -186,8 +186,8 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"header_description": "Flat gray background (default header).",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 3,
- "last_status_at": "2021-09-11",
+ "statuses_count": 4,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": []
}
@@ -232,8 +232,8 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"header_description": "Flat gray background (default header).",
"followers_count": 1,
"following_count": 1,
- "statuses_count": 8,
- "last_status_at": "2021-07-28",
+ "statuses_count": 9,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": [
{
@@ -414,8 +414,8 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"header_description": "Flat gray background (default header).",
"followers_count": 1,
"following_count": 1,
- "statuses_count": 8,
- "last_status_at": "2021-07-28",
+ "statuses_count": 9,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": [
{
@@ -473,8 +473,8 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"header_description": "Flat gray background (default header).",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 3,
- "last_status_at": "2021-09-11",
+ "statuses_count": 4,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": []
}
@@ -485,6 +485,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
{
"id": "01FVW7JHQFSFK166WWKR8CBA6M",
"created_at": "2021-09-20T10:40:37.000Z",
+ "edited_at": null,
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"sensitive": false,
@@ -521,8 +522,8 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"header_description": "Flat gray background (default header).",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 3,
- "last_status_at": "2021-09-11",
+ "statuses_count": 4,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": []
},
@@ -667,8 +668,8 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() {
"header_description": "Flat gray background (default header).",
"followers_count": 1,
"following_count": 1,
- "statuses_count": 8,
- "last_status_at": "2021-07-28",
+ "statuses_count": 9,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": [
{
@@ -726,8 +727,8 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() {
"header_description": "Flat gray background (default header).",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 3,
- "last_status_at": "2021-09-11",
+ "statuses_count": 4,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": []
}
@@ -738,6 +739,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() {
{
"id": "01FVW7JHQFSFK166WWKR8CBA6M",
"created_at": "2021-09-20T10:40:37.000Z",
+ "edited_at": null,
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"sensitive": false,
@@ -774,8 +776,8 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() {
"header_description": "Flat gray background (default header).",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 3,
- "last_status_at": "2021-09-11",
+ "statuses_count": 4,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": []
},
@@ -920,8 +922,8 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() {
"header_description": "Flat gray background (default header).",
"followers_count": 1,
"following_count": 1,
- "statuses_count": 8,
- "last_status_at": "2021-07-28",
+ "statuses_count": 9,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": [
{
@@ -979,8 +981,8 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() {
"header_description": "Flat gray background (default header).",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 3,
- "last_status_at": "2021-09-11",
+ "statuses_count": 4,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": []
}
@@ -991,6 +993,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() {
{
"id": "01FVW7JHQFSFK166WWKR8CBA6M",
"created_at": "2021-09-20T10:40:37.000Z",
+ "edited_at": null,
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"sensitive": false,
@@ -1027,8 +1030,8 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() {
"header_description": "Flat gray background (default header).",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 3,
- "last_status_at": "2021-09-11",
+ "statuses_count": 4,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": []
},
diff --git a/internal/api/client/exports/exports_test.go b/internal/api/client/exports/exports_test.go
index 62997af5d..13f7bea05 100644
--- a/internal/api/client/exports/exports_test.go
+++ b/internal/api/client/exports/exports_test.go
@@ -229,7 +229,7 @@ Cool Ass Posters From This Instance,admin@localhost:8080
"media_storage": "",
"followers_count": 2,
"following_count": 2,
- "statuses_count": 8,
+ "statuses_count": 9,
"lists_count": 1,
"blocks_count": 0,
"mutes_count": 0
diff --git a/internal/api/client/instance/instancepatch_test.go b/internal/api/client/instance/instancepatch_test.go
index efcb3762f..f126ee6ae 100644
--- a/internal/api/client/instance/instancepatch_test.go
+++ b/internal/api/client/instance/instancepatch_test.go
@@ -155,7 +155,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() {
},
"stats": {
"domain_count": 2,
- "status_count": 19,
+ "status_count": 21,
"user_count": 4
},
"thumbnail": "http://localhost:8080/assets/logo.webp",
@@ -296,7 +296,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() {
},
"stats": {
"domain_count": 2,
- "status_count": 19,
+ "status_count": 21,
"user_count": 4
},
"thumbnail": "http://localhost:8080/assets/logo.webp",
@@ -437,7 +437,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() {
},
"stats": {
"domain_count": 2,
- "status_count": 19,
+ "status_count": 21,
"user_count": 4
},
"thumbnail": "http://localhost:8080/assets/logo.webp",
@@ -629,7 +629,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() {
},
"stats": {
"domain_count": 2,
- "status_count": 19,
+ "status_count": 21,
"user_count": 4
},
"thumbnail": "http://localhost:8080/assets/logo.webp",
@@ -792,7 +792,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() {
},
"stats": {
"domain_count": 2,
- "status_count": 19,
+ "status_count": 21,
"user_count": 4
},
"thumbnail": "http://localhost:8080/fileserver/01AY6P665V14JJR0AFVRT7311Y/attachment/original/`+instanceAccount.AvatarMediaAttachment.ID+`.gif",`+`
@@ -974,7 +974,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() {
},
"stats": {
"domain_count": 2,
- "status_count": 19,
+ "status_count": 21,
"user_count": 4
},
"thumbnail": "http://localhost:8080/assets/logo.webp",
diff --git a/internal/api/client/mutes/mutesget_test.go b/internal/api/client/mutes/mutesget_test.go
index fa52c9aa9..13d826398 100644
--- a/internal/api/client/mutes/mutesget_test.go
+++ b/internal/api/client/mutes/mutesget_test.go
@@ -148,7 +148,7 @@ func (suite *MutesTestSuite) TestIndefinitelyMutedAccountSerializesMuteExpiratio
// Fetch all muted accounts for the logged-in account.
// The expected body contains `"mute_expires_at":null`.
- _, err = suite.getMutedAccounts(http.StatusOK, `[{"id":"01F8MH5ZK5VRH73AKHQM6Y9VNX","username":"foss_satan","acct":"foss_satan@fossbros-anonymous.io","display_name":"big gerald","locked":false,"discoverable":true,"bot":false,"created_at":"2021-09-26T10:52:36.000Z","note":"i post about like, i dunno, stuff, or whatever!!!!","url":"http://fossbros-anonymous.io/@foss_satan","avatar":"","avatar_static":"","header":"http://localhost:8080/assets/default_header.webp","header_static":"http://localhost:8080/assets/default_header.webp","header_description":"Flat gray background (default header).","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2021-09-11","emojis":[],"fields":[],"mute_expires_at":null}]`)
+ _, err = suite.getMutedAccounts(http.StatusOK, `[{"id":"01F8MH5ZK5VRH73AKHQM6Y9VNX","username":"foss_satan","acct":"foss_satan@fossbros-anonymous.io","display_name":"big gerald","locked":false,"discoverable":true,"bot":false,"created_at":"2021-09-26T10:52:36.000Z","note":"i post about like, i dunno, stuff, or whatever!!!!","url":"http://fossbros-anonymous.io/@foss_satan","avatar":"","avatar_static":"","header":"http://localhost:8080/assets/default_header.webp","header_static":"http://localhost:8080/assets/default_header.webp","header_description":"Flat gray background (default header).","followers_count":0,"following_count":0,"statuses_count":4,"last_status_at":"2024-11-01","emojis":[],"fields":[],"mute_expires_at":null}]`)
if err != nil {
suite.FailNow(err.Error())
}
diff --git a/internal/api/client/reports/reportget_test.go b/internal/api/client/reports/reportget_test.go
index 8c9dfa1e5..afbcb2e28 100644
--- a/internal/api/client/reports/reportget_test.go
+++ b/internal/api/client/reports/reportget_test.go
@@ -130,8 +130,8 @@ func (suite *ReportGetTestSuite) TestGetReport1() {
"header_description": "Flat gray background (default header).",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 3,
- "last_status_at": "2021-09-11",
+ "statuses_count": 4,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": []
}
diff --git a/internal/api/client/reports/reportsget_test.go b/internal/api/client/reports/reportsget_test.go
index 0eb66e778..b5988e331 100644
--- a/internal/api/client/reports/reportsget_test.go
+++ b/internal/api/client/reports/reportsget_test.go
@@ -156,8 +156,8 @@ func (suite *ReportsGetTestSuite) TestGetReports() {
"header_description": "Flat gray background (default header).",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 3,
- "last_status_at": "2021-09-11",
+ "statuses_count": 4,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": []
}
@@ -247,8 +247,8 @@ func (suite *ReportsGetTestSuite) TestGetReports4() {
"header_description": "Flat gray background (default header).",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 3,
- "last_status_at": "2021-09-11",
+ "statuses_count": 4,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": []
}
@@ -322,8 +322,8 @@ func (suite *ReportsGetTestSuite) TestGetReports6() {
"header_description": "Flat gray background (default header).",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 3,
- "last_status_at": "2021-09-11",
+ "statuses_count": 4,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": []
}
@@ -381,8 +381,8 @@ func (suite *ReportsGetTestSuite) TestGetReports7() {
"header_description": "Flat gray background (default header).",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 3,
- "last_status_at": "2021-09-11",
+ "statuses_count": 4,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": []
}
diff --git a/internal/api/client/search/searchget_test.go b/internal/api/client/search/searchget_test.go
index ab4f46689..2c4efd19c 100644
--- a/internal/api/client/search/searchget_test.go
+++ b/internal/api/client/search/searchget_test.go
@@ -916,7 +916,7 @@ func (suite *SearchGetTestSuite) TestSearchAAny() {
}
suite.Len(searchResult.Accounts, 5)
- suite.Len(searchResult.Statuses, 7)
+ suite.Len(searchResult.Statuses, 8)
suite.Len(searchResult.Hashtags, 0)
}
@@ -959,7 +959,7 @@ func (suite *SearchGetTestSuite) TestSearchAAnyFollowingOnly() {
}
suite.Len(searchResult.Accounts, 2)
- suite.Len(searchResult.Statuses, 7)
+ suite.Len(searchResult.Statuses, 8)
suite.Len(searchResult.Hashtags, 0)
}
@@ -1002,7 +1002,7 @@ func (suite *SearchGetTestSuite) TestSearchAStatuses() {
}
suite.Len(searchResult.Accounts, 0)
- suite.Len(searchResult.Statuses, 7)
+ suite.Len(searchResult.Statuses, 8)
suite.Len(searchResult.Hashtags, 0)
}
diff --git a/internal/api/client/statuses/statusboost_test.go b/internal/api/client/statuses/statusboost_test.go
index 1f92d8b3f..51b7d7652 100644
--- a/internal/api/client/statuses/statusboost_test.go
+++ b/internal/api/client/statuses/statusboost_test.go
@@ -100,6 +100,7 @@ func (suite *StatusBoostTestSuite) TestPostBoost() {
"card": null,
"content": "",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": true,
"favourites_count": 0,
@@ -145,6 +146,7 @@ func (suite *StatusBoostTestSuite) TestPostBoost() {
"card": null,
"content": "hello world! #welcome ! first post on the instance :rainbow: !",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [
{
"category": "reactions",
@@ -280,6 +282,7 @@ func (suite *StatusBoostTestSuite) TestPostBoostOwnFollowersOnly() {
"card": null,
"content": "",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
@@ -329,6 +332,7 @@ func (suite *StatusBoostTestSuite) TestPostBoostOwnFollowersOnly() {
"card": null,
"content": "hi!",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
@@ -494,6 +498,7 @@ func (suite *StatusBoostTestSuite) TestPostBoostImplicitAccept() {
"card": null,
"content": "",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
@@ -539,6 +544,7 @@ func (suite *StatusBoostTestSuite) TestPostBoostImplicitAccept() {
"card": null,
"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>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
diff --git a/internal/api/client/statuses/statuscreate_test.go b/internal/api/client/statuses/statuscreate_test.go
index 5f5386dd5..227e7d83e 100644
--- a/internal/api/client/statuses/statuscreate_test.go
+++ b/internal/api/client/statuses/statuscreate_test.go
@@ -102,6 +102,7 @@ func (suite *StatusCreateTestSuite) TestPostNewStatus() {
"card": null,
"content": "<p>this is a brand new status! <a href=\"http://localhost:8080/tags/helloworld\" class=\"mention hashtag\" rel=\"tag nofollow noreferrer noopener\" target=\"_blank\">#<span>helloworld</span></a></p>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
@@ -187,6 +188,7 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusIntPolicy() {
"card": null,
"content": "<p>this is a brand new status! <a href=\"http://localhost:8080/tags/helloworld\" class=\"mention hashtag\" rel=\"tag nofollow noreferrer noopener\" target=\"_blank\">#<span>helloworld</span></a></p>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
@@ -282,6 +284,7 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusIntPolicyJSON() {
"card": null,
"content": "<p>this is a brand new status! <a href=\"http://localhost:8080/tags/helloworld\" class=\"mention hashtag\" rel=\"tag nofollow noreferrer noopener\" target=\"_blank\">#<span>helloworld</span></a></p>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
@@ -407,6 +410,7 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusMarkdown() {
"card": null,
"content": "<h1>Title</h1><h2>Smaller title</h2><p>This is a post written in <a href=\"https://www.markdownguide.org/\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">markdown</a></p>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
@@ -490,6 +494,7 @@ func (suite *StatusCreateTestSuite) TestMentionUnknownAccount() {
"card": null,
"content": "<p>hello <span class=\"h-card\"><a href=\"https://unknown-instance.com/@brand_new_person\" class=\"u-url mention\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">@<span>brand_new_person</span></a></span></p>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
@@ -567,6 +572,7 @@ func (suite *StatusCreateTestSuite) TestPostStatusWithLinksAndTags() {
"card": null,
"content": "<p><a href=\"http://localhost:8080/tags/test\" class=\"mention hashtag\" rel=\"tag nofollow noreferrer noopener\" target=\"_blank\">#<span>test</span></a> alright, should be able to post <a href=\"http://localhost:8080/tags/links\" class=\"mention hashtag\" rel=\"tag nofollow noreferrer noopener\" target=\"_blank\">#<span>links</span></a> with fragments in them now, let's see........<br><br><a href=\"https://docs.gotosocial.org/en/latest/user_guide/posts/#links\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">https://docs.gotosocial.org/en/latest/user_guide/posts/#links</a><br><br><a href=\"http://localhost:8080/tags/gotosocial\" class=\"mention hashtag\" rel=\"tag nofollow noreferrer noopener\" target=\"_blank\">#<span>gotosocial</span></a><br><br>(tobi remember to pull the docker image challenge)</p>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
@@ -650,6 +656,7 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithEmoji() {
"card": null,
"content": "<p>here is a rainbow emoji a few times! :rainbow: :rainbow: :rainbow:<br>here's an emoji that isn't in the db: :test_emoji:</p>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [
{
"category": "reactions",
@@ -747,6 +754,7 @@ func (suite *StatusCreateTestSuite) TestReplyToLocalStatus() {
"card": null,
"content": "<p>hello <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> this reply should work!</p>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
@@ -829,6 +837,7 @@ func (suite *StatusCreateTestSuite) TestAttachNewMediaSuccess() {
"card": null,
"content": "<p>here's an image attachment</p>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
@@ -933,6 +942,7 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithNoncanonicalLanguageTag
"card": null,
"content": "<p>English? what's English? i speak American</p>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
@@ -1007,6 +1017,7 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithPollForm() {
"card": null,
"content": "<p>this is a status with a poll!</p>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
@@ -1103,6 +1114,7 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusWithPollJSON() {
"card": null,
"content": "<p>this is a status with a poll!</p>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": false,
"favourites_count": 0,
diff --git a/internal/api/client/statuses/statusfave_test.go b/internal/api/client/statuses/statusfave_test.go
index bd81c0cf9..8851b4d58 100644
--- a/internal/api/client/statuses/statusfave_test.go
+++ b/internal/api/client/statuses/statusfave_test.go
@@ -105,6 +105,7 @@ func (suite *StatusFaveTestSuite) TestPostFave() {
"card": null,
"content": "🐕🐕🐕🐕🐕",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": true,
"favourites_count": 1,
@@ -228,6 +229,7 @@ func (suite *StatusFaveTestSuite) TestPostFaveImplicitAccept() {
"card": null,
"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>",
"created_at": "right the hell just now babyee",
+ "edited_at": null,
"emojis": [],
"favourited": true,
"favourites_count": 1,
diff --git a/internal/api/client/statuses/statushistory_test.go b/internal/api/client/statuses/statushistory_test.go
index aea666dbb..3878f54e4 100644
--- a/internal/api/client/statuses/statushistory_test.go
+++ b/internal/api/client/statuses/statushistory_test.go
@@ -116,8 +116,8 @@ func (suite *StatusHistoryTestSuite) TestGetHistory() {
"header_media_id": "01PFPMWK2FF0D9WMHEJHR07C3Q",
"followers_count": 2,
"following_count": 2,
- "statuses_count": 8,
- "last_status_at": "2024-01-10",
+ "statuses_count": 9,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": [],
"enable_rss": true
diff --git a/internal/api/client/statuses/statusmute_test.go b/internal/api/client/statuses/statusmute_test.go
index 384761fc6..66bd4a420 100644
--- a/internal/api/client/statuses/statusmute_test.go
+++ b/internal/api/client/statuses/statusmute_test.go
@@ -91,6 +91,7 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
suite.Equal(`{
"id": "01F8MHAMCHF6Y650WCRSCP4WMY",
"created_at": "2021-10-20T10:40:37.000Z",
+ "edited_at": null,
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"sensitive": true,
@@ -134,8 +135,8 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
"header_media_id": "01PFPMWK2FF0D9WMHEJHR07C3Q",
"followers_count": 2,
"following_count": 2,
- "statuses_count": 8,
- "last_status_at": "2024-01-10",
+ "statuses_count": 9,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": [],
"enable_rss": true
@@ -178,6 +179,7 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
suite.Equal(`{
"id": "01F8MHAMCHF6Y650WCRSCP4WMY",
"created_at": "2021-10-20T10:40:37.000Z",
+ "edited_at": null,
"in_reply_to_id": null,
"in_reply_to_account_id": null,
"sensitive": true,
@@ -221,8 +223,8 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
"header_media_id": "01PFPMWK2FF0D9WMHEJHR07C3Q",
"followers_count": 2,
"following_count": 2,
- "statuses_count": 8,
- "last_status_at": "2024-01-10",
+ "statuses_count": 9,
+ "last_status_at": "2024-11-01",
"emojis": [],
"fields": [],
"enable_rss": true
diff --git a/internal/api/model/content.go b/internal/api/model/content.go
index 7da389ed1..5af81b11b 100644
--- a/internal/api/model/content.go
+++ b/internal/api/model/content.go
@@ -19,7 +19,6 @@ package model
import (
"io"
- "time"
"github.com/superseriousbusiness/gotosocial/internal/storage"
)
@@ -30,8 +29,6 @@ type Content struct {
ContentType string
// ContentLength in bytes
ContentLength int64
- // Time when the content was last updated.
- ContentUpdated time.Time
// Actual content
Content io.ReadCloser
// Resource URL to forward to if the file can be fetched from the storage directly (e.g signed S3 URL)
diff --git a/internal/api/model/status.go b/internal/api/model/status.go
index c29ab3e82..724134b77 100644
--- a/internal/api/model/status.go
+++ b/internal/api/model/status.go
@@ -29,6 +29,10 @@ type Status struct {
// The date when this status was created (ISO 8601 Datetime).
// example: 2021-07-30T09:20:25+00:00
CreatedAt string `json:"created_at"`
+ // Timestamp of when the status was last edited (ISO 8601 Datetime).
+ // example: 2021-07-30T09:20:25+00:00
+ // nullable: true
+ EditedAt *string `json:"edited_at"`
// ID of the status being replied to.
// example: 01FBVD42CQ3ZEEVMW180SBX03B
// nullable: true