mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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 🥲 * more test fixing, ensure the edit.status_id field is actually set 🤦 * 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
This commit is contained in:
@@ -718,7 +718,6 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
||||
URL: "http://localhost:8080/fileserver/01F8MH17FWEB39HZJ76B6VXSKF/attachment/original/01F8MH6NEM8D7527KZAECTCR76.jpg",
|
||||
RemoteURL: "",
|
||||
CreatedAt: TimeMustParse("2022-06-04T13:12:00Z"),
|
||||
UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"),
|
||||
Type: gtsmodel.FileTypeImage,
|
||||
FileMeta: gtsmodel.FileMeta{
|
||||
Original: gtsmodel.Original{
|
||||
@@ -761,7 +760,6 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
||||
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/original/01F8MH7TDVANYKWVE8VVKFPJTJ.gif",
|
||||
RemoteURL: "",
|
||||
CreatedAt: TimeMustParse("2022-06-09T13:12:00Z"),
|
||||
UpdatedAt: TimeMustParse("2022-06-09T13:12:00Z"),
|
||||
Type: gtsmodel.FileTypeImage,
|
||||
FileMeta: gtsmodel.FileMeta{
|
||||
Original: gtsmodel.Original{
|
||||
@@ -808,7 +806,6 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
||||
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/original/01CDR64G398ADCHXK08WWTHEZ5.mp4",
|
||||
RemoteURL: "",
|
||||
CreatedAt: TimeMustParse("2022-06-09T13:12:00Z"),
|
||||
UpdatedAt: TimeMustParse("2022-06-09T13:12:00Z"),
|
||||
Type: gtsmodel.FileTypeVideo,
|
||||
FileMeta: gtsmodel.FileMeta{
|
||||
Original: gtsmodel.Original{
|
||||
@@ -858,7 +855,6 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
||||
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/original/01F8MH8RMYQ6MSNY3JM2XT1CQ5.jpg",
|
||||
RemoteURL: "",
|
||||
CreatedAt: TimeMustParse("2022-06-09T13:12:00Z"),
|
||||
UpdatedAt: TimeMustParse("2022-06-09T13:12:00Z"),
|
||||
Type: gtsmodel.FileTypeImage,
|
||||
FileMeta: gtsmodel.FileMeta{
|
||||
Original: gtsmodel.Original{
|
||||
@@ -905,7 +901,6 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
||||
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg",
|
||||
RemoteURL: "",
|
||||
CreatedAt: TimeMustParse("2022-06-09T13:12:00Z"),
|
||||
UpdatedAt: TimeMustParse("2022-06-09T13:12:00Z"),
|
||||
Type: gtsmodel.FileTypeImage,
|
||||
FileMeta: gtsmodel.FileMeta{
|
||||
Original: gtsmodel.Original{
|
||||
@@ -952,7 +947,6 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
||||
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg",
|
||||
RemoteURL: "",
|
||||
CreatedAt: TimeMustParse("2022-06-09T13:12:00Z"),
|
||||
UpdatedAt: TimeMustParse("2022-06-09T13:12:00Z"),
|
||||
Type: gtsmodel.FileTypeImage,
|
||||
FileMeta: gtsmodel.FileMeta{
|
||||
Original: gtsmodel.Original{
|
||||
@@ -999,7 +993,6 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
||||
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/original/01J2M20K6K9XQC4WSB961YJHV6.mp3",
|
||||
RemoteURL: "",
|
||||
CreatedAt: TimeMustParse("2024-01-10T11:24:00+02:00"),
|
||||
UpdatedAt: TimeMustParse("2024-01-10T11:24:00+02:00"),
|
||||
Type: gtsmodel.FileTypeAudio,
|
||||
FileMeta: gtsmodel.FileMeta{
|
||||
Original: gtsmodel.Original{
|
||||
@@ -1043,13 +1036,30 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
||||
Header: util.Ptr(false),
|
||||
Cached: util.Ptr(true),
|
||||
},
|
||||
"local_account_2_status_9_attachment_1": {
|
||||
ID: "01JDQ164HM08SGJ7ZEK9003Z4B",
|
||||
StatusID: "01JDPZEZ77X1NX0TY9M10BK1HM",
|
||||
URL: "http://localhost:8080/fileserver/01FHMQX3GAABWSM0S2VZEC2SWC/attachment/original/01HE88YG74PVAB81PX2XA9F3FG.mp3",
|
||||
RemoteURL: "http://example.org/fileserver/01HE7Y659ZWZ02JM4AWYJZ176Q/attachment/original/01HE892Y8ZS68TQCNPX7J888P3.mp3",
|
||||
CreatedAt: TimeMustParse("2024-11-01T10:01:00+02:00"),
|
||||
Type: gtsmodel.FileTypeUnknown,
|
||||
FileMeta: gtsmodel.FileMeta{},
|
||||
AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
|
||||
Description: "Jolly salsa song, public domain.",
|
||||
Blurhash: "",
|
||||
Processing: gtsmodel.ProcessingStatusProcessed,
|
||||
File: gtsmodel.File{},
|
||||
Thumbnail: gtsmodel.Thumbnail{RemoteURL: ""},
|
||||
Avatar: util.Ptr(false),
|
||||
Header: util.Ptr(false),
|
||||
Cached: util.Ptr(false),
|
||||
},
|
||||
"remote_account_1_status_1_attachment_1": {
|
||||
ID: "01FVW7RXPQ8YJHTEXYPE7Q8ZY0",
|
||||
StatusID: "01FVW7JHQFSFK166WWKR8CBA6M",
|
||||
URL: "http://localhost:8080/fileserver/01F8MH5ZK5VRH73AKHQM6Y9VNX/attachment/original/01FVW7RXPQ8YJHTEXYPE7Q8ZY0.jpg",
|
||||
RemoteURL: "http://fossbros-anonymous.io/attachments/original/13bbc3f8-2b5e-46ea-9531-40b4974d9912.jpg",
|
||||
CreatedAt: TimeMustParse("2021-09-20T12:40:37+02:00"),
|
||||
UpdatedAt: TimeMustParse("2021-09-20T12:40:37+02:00"),
|
||||
Type: gtsmodel.FileTypeImage,
|
||||
FileMeta: gtsmodel.FileMeta{
|
||||
Original: gtsmodel.Original{
|
||||
@@ -1095,7 +1105,6 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
||||
URL: "http://localhost:8080/fileserver/062G5WYKY35KKD12EMSM3F8PJ8/header/original/01PFPMWK2FF0D9WMHEJHR07C3R.jpg",
|
||||
RemoteURL: "http://fossbros-anonymous.io/attachments/small/a499f55b-2d1e-4acd-98d2-1ac2ba6d79b9.jpg",
|
||||
CreatedAt: TimeMustParse("2022-06-09T13:12:00Z"),
|
||||
UpdatedAt: TimeMustParse("2022-06-09T13:12:00Z"),
|
||||
Type: gtsmodel.FileTypeImage,
|
||||
FileMeta: gtsmodel.FileMeta{
|
||||
Original: gtsmodel.Original{
|
||||
@@ -1141,7 +1150,6 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
||||
URL: "http://localhost:8080/fileserver/01FHMQX3GAABWSM0S2VZEC2SWC/attachment/original/01HE7Y3C432WRSNS10EZM86SA5.jpg",
|
||||
RemoteURL: "http://example.org/fileserver/01HE7Y659ZWZ02JM4AWYJZ176Q/attachment/original/01HE7Y6G0EMCKST3Q0914WW0MS.jpg",
|
||||
CreatedAt: TimeMustParse("2023-11-02T12:44:25+02:00"),
|
||||
UpdatedAt: TimeMustParse("2023-11-02T12:44:25+02:00"),
|
||||
Type: gtsmodel.FileTypeImage,
|
||||
FileMeta: gtsmodel.FileMeta{
|
||||
Original: gtsmodel.Original{
|
||||
@@ -1186,7 +1194,6 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
||||
URL: "http://localhost:8080/fileserver/01FHMQX3GAABWSM0S2VZEC2SWC/attachment/original/01HE7ZFX9GKA5ZZVD4FACABSS9.svg",
|
||||
RemoteURL: "http://example.org/fileserver/01HE7Y659ZWZ02JM4AWYJZ176Q/attachment/original/01HE7ZGJYTSYMXF927GF9353KR.svg",
|
||||
CreatedAt: TimeMustParse("2023-11-02T12:44:25+02:00"),
|
||||
UpdatedAt: TimeMustParse("2023-11-02T12:44:25+02:00"),
|
||||
Type: gtsmodel.FileTypeUnknown,
|
||||
FileMeta: gtsmodel.FileMeta{},
|
||||
AccountID: "01FHMQX3GAABWSM0S2VZEC2SWC",
|
||||
@@ -1205,7 +1212,6 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
||||
URL: "http://localhost:8080/fileserver/01FHMQX3GAABWSM0S2VZEC2SWC/attachment/original/01HE88YG74PVAB81PX2XA9F3FG.mp3",
|
||||
RemoteURL: "http://example.org/fileserver/01HE7Y659ZWZ02JM4AWYJZ176Q/attachment/original/01HE892Y8ZS68TQCNPX7J888P3.mp3",
|
||||
CreatedAt: TimeMustParse("2023-11-02T12:44:25+02:00"),
|
||||
UpdatedAt: TimeMustParse("2023-11-02T12:44:25+02:00"),
|
||||
Type: gtsmodel.FileTypeUnknown,
|
||||
FileMeta: gtsmodel.FileMeta{},
|
||||
AccountID: "01FHMQX3GAABWSM0S2VZEC2SWC",
|
||||
@@ -1739,6 +1745,32 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
|
||||
Federated: util.Ptr(true),
|
||||
ActivityStreamsType: ap.ObjectNote,
|
||||
},
|
||||
"local_account_1_status_9": {
|
||||
ID: "01JDPZC707CKDN8N4QVWM4Z1NR",
|
||||
URI: "http://localhost:8080/users/the_mighty_zork/statuses/01JDPZC707CKDN8N4QVWM4Z1NR",
|
||||
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",
|
||||
ContentWarning: "edited status",
|
||||
AttachmentIDs: nil,
|
||||
CreatedAt: TimeMustParse("2024-11-01T11:00:00+02:00"),
|
||||
UpdatedAt: TimeMustParse("2024-11-01T11:02:00+02:00"),
|
||||
Local: util.Ptr(true),
|
||||
AccountURI: "http://localhost:8080/users/the_mighty_zork",
|
||||
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
|
||||
InReplyToID: "",
|
||||
InReplyToAccountID: "",
|
||||
InReplyToURI: "",
|
||||
BoostOfID: "",
|
||||
ThreadID: "",
|
||||
EditIDs: []string{"01JDPZCZ2Y9KSGZW0R7ZG8T8Y2", "01JDPZDADMD1T9HKF94RECF7PP"},
|
||||
Visibility: gtsmodel.VisibilityPublic,
|
||||
Sensitive: util.Ptr(false),
|
||||
Language: "en",
|
||||
CreatedWithApplicationID: "01F8MGY43H3N2C8EWPR2FPYEXG",
|
||||
Federated: util.Ptr(true),
|
||||
ActivityStreamsType: ap.ObjectNote,
|
||||
},
|
||||
"local_account_2_status_1": {
|
||||
ID: "01F8MHBQCBTDKN6X5VHGMMN4MA",
|
||||
URI: "http://localhost:8080/users/1happyturtle/statuses/01F8MHBQCBTDKN6X5VHGMMN4MA",
|
||||
@@ -1967,6 +1999,32 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
|
||||
PollID: "01HEN2QB5NR4NCEHGYC3HN84K6",
|
||||
PendingApproval: util.Ptr(false),
|
||||
},
|
||||
"local_account_2_status_9": {
|
||||
ID: "01JDPZEZ77X1NX0TY9M10BK1HM",
|
||||
URI: "http://localhost:8080/users/1happyturtle/statuses/01JDPZEZ77X1NX0TY9M10BK1HM",
|
||||
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!",
|
||||
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"),
|
||||
Local: util.Ptr(true),
|
||||
AccountURI: "http://localhost:8080/users/the_mighty_zork",
|
||||
AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
|
||||
InReplyToID: "",
|
||||
InReplyToAccountID: "",
|
||||
InReplyToURI: "",
|
||||
BoostOfID: "",
|
||||
ThreadID: "",
|
||||
EditIDs: []string{"01JDPZPBXAX0M02YSEPB21KX4R", "01JDPZPJHKP7E3M0YQXEXPS1YT", "01JDPZPY3F85Y7B78ETRXEMWD9"},
|
||||
Visibility: gtsmodel.VisibilityPublic,
|
||||
Sensitive: util.Ptr(false),
|
||||
Language: "en",
|
||||
CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ",
|
||||
Federated: util.Ptr(true),
|
||||
ActivityStreamsType: ap.ObjectNote,
|
||||
},
|
||||
"remote_account_1_status_1": {
|
||||
ID: "01FVW7JHQFSFK166WWKR8CBA6M",
|
||||
URI: "http://fossbros-anonymous.io/users/foss_satan/statuses/01FVW7JHQFSFK166WWKR8CBA6M",
|
||||
@@ -2042,6 +2100,33 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
|
||||
PollID: "01HEWV1GW2D49R919NPEDXPTZ5",
|
||||
PendingApproval: util.Ptr(false),
|
||||
},
|
||||
"remote_account_1_status_4": {
|
||||
ID: "01JDQ07JZTX9CMDJP67CNA71YD",
|
||||
URI: "http://fossbros-anonymous.io/users/foss_satan/statuses/______",
|
||||
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",
|
||||
ContentWarning: "",
|
||||
AttachmentIDs: nil,
|
||||
CreatedAt: TimeMustParse("2024-11-01T09:00:00+02:00"),
|
||||
UpdatedAt: TimeMustParse("2024-11-01T09:02:00+02:00"),
|
||||
Local: util.Ptr(false),
|
||||
AccountURI: "http://fossbros-anonymous.io/users/foss_satan",
|
||||
AccountID: "01F8MH5ZK5VRH73AKHQM6Y9VNX",
|
||||
InReplyToID: "",
|
||||
InReplyToAccountID: "",
|
||||
InReplyToURI: "",
|
||||
BoostOfID: "",
|
||||
ThreadID: "",
|
||||
EditIDs: []string{"01JDQ07ZZ4FGP13YN8TF63P5A6", "01JDQ08AYQC0G6413VAHA51CV9"},
|
||||
PollID: "01JDQ0EZ5HM9T4WXRQ5WSVD40J",
|
||||
Visibility: gtsmodel.VisibilityPublic,
|
||||
Sensitive: util.Ptr(false),
|
||||
Language: "en",
|
||||
CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ",
|
||||
Federated: util.Ptr(true),
|
||||
ActivityStreamsType: ap.ObjectNote,
|
||||
},
|
||||
"remote_account_2_status_1": {
|
||||
ID: "01HE7XJ1CG84TBKH5V9XKBVGF5",
|
||||
URI: "http://example.org/users/Some_User/statuses/01HE7XJ1CG84TBKH5V9XKBVGF5",
|
||||
@@ -2125,6 +2210,19 @@ func NewTestPolls() map[string]*gtsmodel.Poll {
|
||||
ClosedAt: time.Time{},
|
||||
Closing: false,
|
||||
},
|
||||
"remote_account_1_status_4_poll": {
|
||||
ID: "01JDQ0EZ5HM9T4WXRQ5WSVD40J",
|
||||
Multiple: util.Ptr(false),
|
||||
HideCounts: util.Ptr(false),
|
||||
Options: []string{"yes", "no", "maybe", "i don't know", "can you repeat the question"},
|
||||
Votes: []int{0, 0, 0, 0, 2},
|
||||
Voters: util.Ptr(2),
|
||||
StatusID: "01JDQ07JZTX9CMDJP67CNA71YD",
|
||||
// empty expiry AND closed date, i.e. no end
|
||||
ExpiresAt: time.Time{},
|
||||
ClosedAt: time.Time{},
|
||||
Closing: false,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2184,6 +2282,24 @@ func NewTestPollVotes() map[string]*gtsmodel.PollVote {
|
||||
Poll: nil,
|
||||
CreatedAt: TimeMustParse("2021-09-11T11:47:37+02:00"),
|
||||
},
|
||||
"remote_account_1_status_4_poll_vote_local_account_1": {
|
||||
ID: "01JDQ0SX9QVVFHS7P8M1PA3SVG",
|
||||
Choices: []int{4},
|
||||
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
|
||||
Account: nil,
|
||||
PollID: "01JDQ0EZ5HM9T4WXRQ5WSVD40J",
|
||||
Poll: nil,
|
||||
CreatedAt: TimeMustParse("2024-11-01T09:01:30+02:00"),
|
||||
},
|
||||
"remote_account_1_status_4_poll_vote_local_account_2": {
|
||||
ID: "01JDQ0T3EEDN7SAVBQMQP4PR12",
|
||||
Choices: []int{4},
|
||||
AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
|
||||
Account: nil,
|
||||
PollID: "01JDQ0EZ5HM9T4WXRQ5WSVD40J",
|
||||
Poll: nil,
|
||||
CreatedAt: TimeMustParse("2024-11-01T09:02:30+02:00"),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2341,7 +2457,6 @@ func NewTestMentions() map[string]*gtsmodel.Mention {
|
||||
ID: "01FCTA2Y6FGHXQA4ZE6N5NMNEX",
|
||||
StatusID: "01FCTA44PW9H1TB328S9AQXKDS",
|
||||
CreatedAt: TimeMustParse("2022-05-14T13:21:09+02:00"),
|
||||
UpdatedAt: TimeMustParse("2022-05-14T13:21:09+02:00"),
|
||||
OriginAccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
|
||||
OriginAccountURI: "http://localhost:8080/users/the_mighty_zork",
|
||||
TargetAccountID: "01F8MH5ZK5VRH73AKHQM6Y9VNX",
|
||||
@@ -2353,7 +2468,6 @@ func NewTestMentions() map[string]*gtsmodel.Mention {
|
||||
ID: "01FDF2HM2NF6FSRZCDEDV451CN",
|
||||
StatusID: "01FCQSQ667XHJ9AV9T27SJJSX5",
|
||||
CreatedAt: TimeMustParse("2022-05-14T13:21:09+02:00"),
|
||||
UpdatedAt: TimeMustParse("2022-05-14T13:21:09+02:00"),
|
||||
OriginAccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
|
||||
OriginAccountURI: "http://localhost:8080/users/1happyturtle",
|
||||
TargetAccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
|
||||
@@ -2365,7 +2479,6 @@ func NewTestMentions() map[string]*gtsmodel.Mention {
|
||||
ID: "01FN3VKDEF4CN2W9TKX339BEHB",
|
||||
StatusID: "01FN3VJGFH10KR7S2PB0GFJZYG",
|
||||
CreatedAt: TimeMustParse("2022-05-14T13:21:09+02:00"),
|
||||
UpdatedAt: TimeMustParse("2022-05-14T13:21:09+02:00"),
|
||||
OriginAccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
|
||||
OriginAccountURI: "http://localhost:8080/users/1happyturtle",
|
||||
TargetAccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
|
||||
@@ -2377,7 +2490,6 @@ func NewTestMentions() map[string]*gtsmodel.Mention {
|
||||
ID: "01FF26A6BGEKCZFWNEHXB2ZZ6M",
|
||||
StatusID: "01FF25D5Q0DH7CHD57CTRS6WK0",
|
||||
CreatedAt: TimeMustParse("2022-05-14T13:21:09+02:00"),
|
||||
UpdatedAt: TimeMustParse("2022-05-14T13:21:09+02:00"),
|
||||
OriginAccountID: "01F8MH17FWEB39HZJ76B6VXSKF",
|
||||
OriginAccountURI: "http://localhost:8080/users/admin",
|
||||
TargetAccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
|
||||
@@ -2389,7 +2501,6 @@ func NewTestMentions() map[string]*gtsmodel.Mention {
|
||||
ID: "01J5QVP69ANF1K4WHES6GA4WXP",
|
||||
StatusID: "01J5QVB9VC76NPPRQ207GG4DRZ",
|
||||
CreatedAt: TimeMustParse("2024-02-20T12:41:37+02:00"),
|
||||
UpdatedAt: TimeMustParse("2024-02-20T12:41:37+02:00"),
|
||||
OriginAccountID: "01F8MH17FWEB39HZJ76B6VXSKF",
|
||||
OriginAccountURI: "http://localhost:8080/users/admin",
|
||||
TargetAccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
|
||||
@@ -2401,7 +2512,6 @@ func NewTestMentions() map[string]*gtsmodel.Mention {
|
||||
ID: "01HE7XQNMKTVC8MNPCE1JGK4J3",
|
||||
StatusID: "01HE7XJ1CG84TBKH5V9XKBVGF5",
|
||||
CreatedAt: TimeMustParse("2023-11-02T12:44:25+02:00"),
|
||||
UpdatedAt: TimeMustParse("2023-11-02T12:44:25+02:00"),
|
||||
OriginAccountID: "01FHMQX3GAABWSM0S2VZEC2SWC",
|
||||
OriginAccountURI: "http://example.org/users/Some_User",
|
||||
TargetAccountID: "01F8MH17FWEB39HZJ76B6VXSKF",
|
||||
@@ -3490,6 +3600,102 @@ 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>",
|
||||
ContentWarning: "",
|
||||
Text: "this is the original status",
|
||||
Language: "en",
|
||||
Sensitive: util.Ptr(false),
|
||||
AttachmentIDs: nil,
|
||||
PollOptions: nil,
|
||||
PollVotes: nil,
|
||||
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",
|
||||
Language: "en",
|
||||
Sensitive: util.Ptr(false),
|
||||
AttachmentIDs: nil,
|
||||
PollOptions: nil,
|
||||
PollVotes: nil,
|
||||
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>",
|
||||
ContentWarning: "",
|
||||
Text: "this is the original status",
|
||||
Language: "en",
|
||||
Sensitive: util.Ptr(false),
|
||||
AttachmentIDs: nil,
|
||||
PollOptions: nil,
|
||||
PollVotes: nil,
|
||||
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!",
|
||||
Language: "en",
|
||||
Sensitive: util.Ptr(true),
|
||||
AttachmentIDs: []string{"01JDQ164HM08SGJ7ZEK9003Z4B"},
|
||||
PollOptions: nil,
|
||||
PollVotes: nil,
|
||||
StatusID: "01JDPZEZ77X1NX0TY9M10BK1HM",
|
||||
CreatedAt: TimeMustParse("2024-11-01T10:01:00+02:00"),
|
||||
},
|
||||
"local_account_2_status_9_edit_3": {
|
||||
ID: "01JDPZPY3F85Y7B78ETRXEMWD9",
|
||||
Content: "<p>now edited to remove the media</p>",
|
||||
ContentWarning: "edit missing previous media attachments",
|
||||
Text: "now edited to remove the media",
|
||||
Language: "en",
|
||||
Sensitive: util.Ptr(false),
|
||||
AttachmentIDs: nil,
|
||||
PollOptions: nil,
|
||||
PollVotes: nil,
|
||||
StatusID: "01JDPZEZ77X1NX0TY9M10BK1HM",
|
||||
CreatedAt: TimeMustParse("2024-11-01T10:02:00+02:00"),
|
||||
},
|
||||
"remote_account_1_status_4_edit_1": {
|
||||
ID: "01JDQ07ZZ4FGP13YN8TF63P5A6",
|
||||
Content: "<p>this is the original status, with a poll!</p>",
|
||||
ContentWarning: "",
|
||||
Text: "this is the original status, with a poll!",
|
||||
Language: "en",
|
||||
Sensitive: util.Ptr(false),
|
||||
AttachmentIDs: nil,
|
||||
PollOptions: []string{"yes", "no", "spiderman"},
|
||||
PollVotes: []int{42, 42, 69},
|
||||
StatusID: "01JDQ07JZTX9CMDJP67CNA71YD",
|
||||
CreatedAt: TimeMustParse("2024-11-01T09:00:00+02:00"),
|
||||
},
|
||||
"remote_account_1_status_4_edit_2": {
|
||||
ID: "01JDQ08AYQC0G6413VAHA51CV9",
|
||||
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!",
|
||||
Language: "en",
|
||||
Sensitive: util.Ptr(false),
|
||||
AttachmentIDs: nil,
|
||||
PollOptions: []string{"yes", "no", "maybe", "i don't know", "can you repeat the question"},
|
||||
PollVotes: []int{0, 0, 0, 0, 1},
|
||||
StatusID: "01JDQ07JZTX9CMDJP67CNA71YD",
|
||||
CreatedAt: TimeMustParse("2024-11-01T09:01:00+02:00"),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// GetSignatureForActivity prepares a mock HTTP request as if it were going to deliver activity to destination signed for privkey and pubKeyID, signs the request and returns the header values.
|
||||
func GetSignatureForActivity(activity pub.Activity, pubKeyID string, privkey *rsa.PrivateKey, destination *url.URL) (signatureHeader string, digestHeader string, dateHeader string) {
|
||||
// convert the activity into json bytes
|
||||
|
Reference in New Issue
Block a user