[feature] add support for polls + receiving federated status edits (#2330)

This commit is contained in:
kim
2023-11-08 14:32:17 +00:00
committed by GitHub
parent 7204ccedc3
commit e9e5dc5a40
84 changed files with 3992 additions and 570 deletions

View File

@@ -1538,6 +1538,33 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
Likeable: util.Ptr(true),
ActivityStreamsType: ap.ObjectNote,
},
"local_account_1_status_6": {
ID: "01HEN2RZ8BG29Y5Z9VJC73HZW7",
URI: "http://localhost:8080/users/the_mighty_zork/statuses/065TKBPE0H2AH8S5X8JCK4XC58",
URL: "http://localhost:8080/@the_mighty_zork/statuses/065TKBPE0H2AH8S5X8JCK4XC58",
Content: "what do you think of sloths?",
Text: "what do you think of sloths?",
AttachmentIDs: nil,
CreatedAt: TimeMustParse("2022-05-20T11:41:10Z"),
UpdatedAt: TimeMustParse("2022-05-20T11:41:10Z"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/the_mighty_zork",
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
InReplyToID: "",
BoostOfID: "",
ThreadID: "",
ContentWarning: "",
Visibility: gtsmodel.VisibilityFollowersOnly,
Sensitive: util.Ptr(false),
Language: "en",
CreatedWithApplicationID: "01F8MGY43H3N2C8EWPR2FPYEXG",
Federated: util.Ptr(true),
Boostable: util.Ptr(true),
Replyable: util.Ptr(true),
Likeable: util.Ptr(true),
ActivityStreamsType: ap.ActivityQuestion,
PollID: "01HEN2RKT1YTEZ80SA8HGP105F",
},
"local_account_2_status_1": {
ID: "01F8MHBQCBTDKN6X5VHGMMN4MA",
URI: "http://localhost:8080/users/1happyturtle/statuses/01F8MHBQCBTDKN6X5VHGMMN4MA",
@@ -1722,6 +1749,33 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
Likeable: util.Ptr(true),
ActivityStreamsType: ap.ObjectNote,
},
"local_account_2_status_8": {
ID: "01HEN2PRXT0TF4YDRA64FZZRN7",
URI: "http://localhost:8080/users/1happyturtle/statuses/065TKBPE0EJ6X3QDR1AH9DAB8M",
URL: "http://localhost:8080/@1happyturtle/statuses/065TKBPE0EJ6X3QDR1AH9DAB8M",
Content: "hey everyone i got stuck in a shed. any ideas for how to get out?",
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"),
Local: util.Ptr(true),
AccountURI: "http://localhost:8080/users/1happyturtle",
AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
InReplyToID: "",
BoostOfID: "",
ThreadID: "",
ContentWarning: "",
Visibility: gtsmodel.VisibilityPublic,
Sensitive: util.Ptr(false),
Language: "en",
CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ",
Federated: util.Ptr(true),
Boostable: util.Ptr(true),
Replyable: util.Ptr(true),
Likeable: util.Ptr(true),
ActivityStreamsType: ap.ActivityQuestion,
PollID: "01HEN2QB5NR4NCEHGYC3HN84K6",
},
"remote_account_1_status_1": {
ID: "01FVW7JHQFSFK166WWKR8CBA6M",
URI: "http://fossbros-anonymous.io/users/foss_satan/statuses/01FVW7JHQFSFK166WWKR8CBA6M",
@@ -1749,6 +1803,136 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
Likeable: util.Ptr(true),
ActivityStreamsType: ap.ObjectNote,
},
"remote_account_1_status_2": {
ID: "01HEN2QRFA8H3C6QPN7RD4KSR6",
URI: "http://fossbros-anonymous.io/users/foss_satan/statuses/065TKDN4BX1PC8N19TSY9SD2N4",
URL: "http://fossbros-anonymous.io/@foss_satan/statuses/065TKDN4BX1PC8N19TSY9SD2N4",
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"),
Local: util.Ptr(false),
AccountURI: "http://fossbros-anonymous.io/users/foss_satan",
AccountID: "01F8MH5ZK5VRH73AKHQM6Y9VNX",
InReplyToID: "",
InReplyToAccountID: "",
InReplyToURI: "",
BoostOfID: "",
ContentWarning: "",
Visibility: gtsmodel.VisibilityUnlocked,
Sensitive: util.Ptr(false),
Language: "en",
CreatedWithApplicationID: "",
Federated: util.Ptr(true),
Boostable: util.Ptr(true),
Replyable: util.Ptr(true),
Likeable: util.Ptr(true),
ActivityStreamsType: ap.ActivityQuestion,
PollID: "01HEN2R65468ZG657C4ZPHJ4EX",
},
}
}
func NewTestPolls() map[string]*gtsmodel.Poll {
return map[string]*gtsmodel.Poll{
"local_account_1_status_6_poll": {
ID: "01HEN2RKT1YTEZ80SA8HGP105F",
Multiple: util.Ptr(false),
HideCounts: util.Ptr(true),
Options: []string{"good", "bad", "meh"},
Votes: []int{2, 0, 0}, // needs to match stored poll votes
Voters: util.Ptr(2), // needs to match stored poll votes
StatusID: "01HEN2RZ8BG29Y5Z9VJC73HZW7",
Status: nil,
ExpiresAt: TimeMustParse("2022-05-21T11:41:10Z"),
ClosedAt: time.Time{},
Closing: false,
},
"local_account_2_status_8_poll": {
ID: "01HEN2QB5NR4NCEHGYC3HN84K6",
Multiple: util.Ptr(false),
HideCounts: util.Ptr(false),
Options: []string{"50:50", "phone a friend", "ask the audience"},
Votes: []int{0, 1, 1}, // needs to match stored poll votes
Voters: util.Ptr(2), // needs to match stored poll votes
StatusID: "01HEN2PRXT0TF4YDRA64FZZRN7",
Status: nil,
ExpiresAt: TimeMustParse("2021-08-28T10:40:37+02:00"),
ClosedAt: TimeMustParse("2021-08-28T10:40:37+02:00"),
Closing: false,
},
"remote_account_1_status_2_poll": {
ID: "01HEN2R65468ZG657C4ZPHJ4EX",
Multiple: util.Ptr(true),
HideCounts: util.Ptr(false),
Options: []string{"vaseline", "tissues", "financial times"},
Votes: []int{3, 2, 18},
Voters: util.Ptr(6),
StatusID: "01HEN2QRFA8H3C6QPN7RD4KSR6",
Status: nil,
ExpiresAt: TimeMustParse("2021-09-11T12:40:37+02:00"),
ClosedAt: TimeMustParse("2021-09-11T12:40:37+02:00"),
Closing: false,
},
}
}
func NewTestPollVotes() map[string]*gtsmodel.PollVote {
return map[string]*gtsmodel.PollVote{
"local_account_1_status_6_poll_vote_local_account_2": {
ID: "01HEN2VN4DZ4ENCK6AS4PKM5B3",
Choices: []int{0},
AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
Account: nil,
PollID: "01HEN2RKT1YTEZ80SA8HGP105F",
Poll: nil,
CreatedAt: TimeMustParse("2022-05-20T14:41:10Z"),
},
"local_account_1_status_6_poll_vote_remote_account_1": {
ID: "01HEN2VM975JG8N9KPFQ597KGF",
Choices: []int{0},
AccountID: "01F8MH5ZK5VRH73AKHQM6Y9VNX",
Account: nil,
PollID: "01HEN2RKT1YTEZ80SA8HGP105F",
Poll: nil,
CreatedAt: TimeMustParse("2022-05-20T15:41:10Z"),
},
"local_account_2_status_8_poll_vote_local_account_1": {
ID: "01HEN2VK9TX5BTD3B0CSRBWE89",
Choices: []int{2},
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
Account: nil,
PollID: "01HEN2QB5NR4NCEHGYC3HN84K6",
Poll: nil,
CreatedAt: TimeMustParse("2021-07-29T10:40:37+02:00"),
},
"local_account_2_status_8_poll_vote_remote_account_1": {
ID: "01HEN2VHW4HAHBM4YH3N55794D",
Choices: []int{1},
AccountID: "01F8MH5ZK5VRH73AKHQM6Y9VNX",
Account: nil,
PollID: "01HEN2QB5NR4NCEHGYC3HN84K6",
Poll: nil,
CreatedAt: TimeMustParse("2021-08-10T10:40:37+02:00"),
},
"remote_account_1_status_2_poll_vote_local_account_1": {
ID: "01HEN2VH077W1QY7VKQFPKD6B6",
Choices: []int{1, 2},
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
Account: nil,
PollID: "01HEN2R65468ZG657C4ZPHJ4EX",
Poll: nil,
CreatedAt: TimeMustParse("2021-09-11T11:45:37+02:00"),
},
"remote_account_1_status_2_poll_vote_local_account_2": {
ID: "01HEN2VG6EP3GJA208586H356K",
Choices: []int{0, 2},
AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
Account: nil,
PollID: "01HEN2R65468ZG657C4ZPHJ4EX",
Poll: nil,
CreatedAt: TimeMustParse("2021-09-11T11:47:37+02:00"),
},
}
}