diff options
author | 2023-10-25 16:04:53 +0200 | |
---|---|---|
committer | 2023-10-25 15:04:53 +0100 | |
commit | c7b6cd7770cad9bfdc23decffa7c4068752dbbbd (patch) | |
tree | 0f039fd34fb0287860fce06ff1c30dedd1882136 /testrig | |
parent | [bugfix] allow store smaller PNG image than 261 bytes (#2263) (#2298) (diff) | |
download | gotosocial-c7b6cd7770cad9bfdc23decffa7c4068752dbbbd.tar.xz |
[feature] Status thread mute/unmute functionality (#2278)
* add db models + functions for keeping track of threads
* give em the old linty testy
* create, remove, check mutes
* swagger
* testerino
* test mute/unmute via api
* add info log about new index creation
* thread + allow muting of any remote statuses that mention a local account
* IsStatusThreadMutedBy -> IsThreadMutedByAccount
* use common processing functions in status processor
* set = NULL
* favee!
* get rekt darlings, darlings get rekt
* testrig please, have mercy muy liege
Diffstat (limited to 'testrig')
-rw-r--r-- | testrig/db.go | 16 | ||||
-rw-r--r-- | testrig/testmodels.go | 121 |
2 files changed, 136 insertions, 1 deletions
diff --git a/testrig/db.go b/testrig/db.go index 57e94a4bf..771345fe1 100644 --- a/testrig/db.go +++ b/testrig/db.go @@ -49,8 +49,10 @@ var testModels = []interface{}{ >smodel.StatusToTag{}, >smodel.StatusFave{}, >smodel.StatusBookmark{}, - >smodel.StatusMute{}, >smodel.Tag{}, + >smodel.Thread{}, + >smodel.ThreadMute{}, + >smodel.ThreadToStatus{}, >smodel.User{}, >smodel.Emoji{}, >smodel.Instance{}, @@ -301,6 +303,18 @@ func StandardDBSetup(db db.DB, accounts map[string]*gtsmodel.Account) { } } + for _, v := range NewTestThreads() { + if err := db.Put(ctx, v); err != nil { + log.Panic(nil, err) + } + } + + for _, v := range NewTestThreadToStatus() { + if err := db.Put(ctx, v); err != nil { + log.Panic(nil, err) + } + } + if err := db.CreateInstanceAccount(ctx); err != nil { log.Panic(nil, err) } diff --git a/testrig/testmodels.go b/testrig/testmodels.go index 5279ec725..5c9c9259d 100644 --- a/testrig/testmodels.go +++ b/testrig/testmodels.go @@ -1318,6 +1318,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", InReplyToID: "", BoostOfID: "", + ThreadID: "01HCWDF2Q4HV5QC161C4TGQ0M3", ContentWarning: "", Visibility: gtsmodel.VisibilityPublic, Sensitive: util.Ptr(false), @@ -1343,6 +1344,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", InReplyToID: "", BoostOfID: "", + ThreadID: "01HCWDQ1C7APSEY34B1HFVHVX7", ContentWarning: "open to see some puppies", Visibility: gtsmodel.VisibilityPublic, Sensitive: util.Ptr(true), @@ -1370,6 +1372,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { InReplyToAccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", InReplyToURI: "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY", BoostOfID: "", + ThreadID: "01HCWDKKBWECZJQ93E262N36VN", Visibility: gtsmodel.VisibilityPublic, Sensitive: util.Ptr(false), Language: "en", @@ -1396,6 +1399,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { InReplyToURI: "", BoostOfID: "01F8MHAMCHF6Y650WCRSCP4WMY", BoostOfAccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", + ThreadID: "", ContentWarning: "introduction post", Visibility: gtsmodel.VisibilityPublic, Sensitive: util.Ptr(true), @@ -1420,6 +1424,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", InReplyToID: "", BoostOfID: "", + ThreadID: "01HCWDKKBWECZJQ93E262N36VN", ContentWarning: "introduction post", Visibility: gtsmodel.VisibilityPublic, Sensitive: util.Ptr(true), @@ -1444,6 +1449,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", InReplyToID: "", BoostOfID: "", + ThreadID: "01HCWDVTW3HQWSX66VJQ91Z1RH", ContentWarning: "", Visibility: gtsmodel.VisibilityUnlocked, Sensitive: util.Ptr(false), @@ -1468,6 +1474,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", InReplyToID: "", BoostOfID: "", + ThreadID: "01HCWDY9PDNHDBDBBFTJKJY8XE", ContentWarning: "test: you shouldn't be able to interact with this post in any way", Visibility: gtsmodel.VisibilityMutualsOnly, Sensitive: util.Ptr(false), @@ -1493,6 +1500,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", InReplyToID: "", BoostOfID: "", + ThreadID: "01HCWE0H2GKH794Q7GDPANH91Q", ContentWarning: "eye contact, trent reznor gif, cow", Visibility: gtsmodel.VisibilityMutualsOnly, Sensitive: util.Ptr(false), @@ -1518,6 +1526,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", InReplyToID: "", BoostOfID: "", + ThreadID: "01HCWE1ERQSMMVWDD0BE491E2P", ContentWarning: "", Visibility: gtsmodel.VisibilityFollowersOnly, Sensitive: util.Ptr(false), @@ -1542,6 +1551,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", InReplyToID: "", BoostOfID: "", + ThreadID: "01HCWE2Q24FWCZE41AS77SDFRZ", ContentWarning: "introduction post", Visibility: gtsmodel.VisibilityPublic, Sensitive: util.Ptr(true), @@ -1566,6 +1576,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", InReplyToID: "", BoostOfID: "", + ThreadID: "01HCWE3P291Z3NJEJVFPW0K9ZQ", ContentWarning: "", Visibility: gtsmodel.VisibilityPublic, Sensitive: util.Ptr(true), @@ -1590,6 +1601,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", InReplyToID: "", BoostOfID: "", + ThreadID: "01HCWE4P0EW9HBA5WHW97D5YV0", ContentWarning: "you won't be able to like or reply to this", Visibility: gtsmodel.VisibilityUnlocked, Sensitive: util.Ptr(true), @@ -1614,6 +1626,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", InReplyToID: "", BoostOfID: "", + ThreadID: "01HCWE5JXFPFP3P5W2QNHVVV27", ContentWarning: "", Visibility: gtsmodel.VisibilityPublic, Sensitive: util.Ptr(true), @@ -1642,6 +1655,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { InReplyToAccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", InReplyToURI: "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY", BoostOfID: "", + ThreadID: "01HCWDKKBWECZJQ93E262N36VN", ContentWarning: "", Visibility: gtsmodel.VisibilityPublic, Sensitive: util.Ptr(false), @@ -1669,6 +1683,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { InReplyToAccountID: "", InReplyToURI: "", BoostOfID: "", + ThreadID: "01HCWE71MGRRDSHBKXFD5DDSWR", ContentWarning: "", Visibility: gtsmodel.VisibilityDirect, Sensitive: util.Ptr(false), @@ -1695,6 +1710,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status { AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF", InReplyToID: "", BoostOfID: "", + ThreadID: "01HCWE7ZNC2SS4P05WA5QYED23", ContentWarning: "", Visibility: gtsmodel.VisibilityFollowersOnly, Sensitive: util.Ptr(false), @@ -1767,6 +1783,111 @@ func NewTestStatusToTags() map[string]*gtsmodel.StatusToTag { } } +func NewTestThreads() map[string]*gtsmodel.Thread { + return map[string]*gtsmodel.Thread{ + "admin_account_status_1": { + ID: "01HCWDF2Q4HV5QC161C4TGQ0M3", + }, + "admin_account_status_2": { + ID: "01HCWDQ1C7APSEY34B1HFVHVX7", + }, + "local_account_1_status_1": { + ID: "01HCWDKKBWECZJQ93E262N36VN", + }, + "local_account_1_status_2": { + ID: "01HCWDVTW3HQWSX66VJQ91Z1RH", + }, + "local_account_1_status_3": { + ID: "01HCWDY9PDNHDBDBBFTJKJY8XE", + }, + "local_account_1_status_4": { + ID: "01HCWE0H2GKH794Q7GDPANH91Q", + }, + "local_account_1_status_5": { + ID: "01HCWE1ERQSMMVWDD0BE491E2P", + }, + "local_account_2_status_1": { + ID: "01HCWE2Q24FWCZE41AS77SDFRZ", + }, + "local_account_2_status_2": { + ID: "01HCWE3P291Z3NJEJVFPW0K9ZQ", + }, + "local_account_2_status_3": { + ID: "01HCWE4P0EW9HBA5WHW97D5YV0", + }, + "local_account_2_status_4": { + ID: "01HCWE5JXFPFP3P5W2QNHVVV27", + }, + "local_account_2_status_6": { + ID: "01HCWE71MGRRDSHBKXFD5DDSWR", + }, + "local_account_2_status_7": { + ID: "01HCWE7ZNC2SS4P05WA5QYED23", + }, + } +} + +func NewTestThreadToStatus() []*gtsmodel.ThreadToStatus { + return []*gtsmodel.ThreadToStatus{ + { + ThreadID: "01HCWDF2Q4HV5QC161C4TGQ0M3", + StatusID: "01F8MH75CBF9JFX4ZAD54N0W0R", + }, + { + ThreadID: "01HCWDQ1C7APSEY34B1HFVHVX7", + StatusID: "01F8MHAAY43M6RJ473VQFCVH37", + }, + { + ThreadID: "01HCWDKKBWECZJQ93E262N36VN", + StatusID: "01FF25D5Q0DH7CHD57CTRS6WK0", + }, + { + ThreadID: "01HCWDKKBWECZJQ93E262N36VN", + StatusID: "01F8MHAMCHF6Y650WCRSCP4WMY", + }, + { + ThreadID: "01HCWDVTW3HQWSX66VJQ91Z1RH", + StatusID: "01F8MHAYFKS4KMXF8K5Y1C0KRN", + }, + { + ThreadID: "01HCWDY9PDNHDBDBBFTJKJY8XE", + StatusID: "01F8MHBBN8120SYH7D5S050MGK", + }, + { + ThreadID: "01HCWE0H2GKH794Q7GDPANH91Q", + StatusID: "01F8MH82FYRXD2RC6108DAJ5HB", + }, + { + ThreadID: "01HCWE1ERQSMMVWDD0BE491E2P", + StatusID: "01FCTA44PW9H1TB328S9AQXKDS", + }, + { + ThreadID: "01HCWE2Q24FWCZE41AS77SDFRZ", + StatusID: "01F8MHBQCBTDKN6X5VHGMMN4MA", + }, + { + ThreadID: "01HCWE3P291Z3NJEJVFPW0K9ZQ", + StatusID: "01F8MHC0H0A7XHTVH5F596ZKBM", + }, + { + ThreadID: "01HCWE4P0EW9HBA5WHW97D5YV0", + StatusID: "01F8MHC8VWDRBQR0N1BATDDEM5", + }, + { + ThreadID: "01HCWDKKBWECZJQ93E262N36VN", + StatusID: "01FCQSQ667XHJ9AV9T27SJJSX5", + }, + { + ThreadID: "01HCWE71MGRRDSHBKXFD5DDSWR", + StatusID: "01FN3VJGFH10KR7S2PB0GFJZYG", + }, + { + ThreadID: "01HCWE7ZNC2SS4P05WA5QYED23", + StatusID: "01G20ZM733MGN8J344T4ZDDFY1", + }, + } +} + // NewTestMentions returns a map of gts model mentions keyed by their name. func NewTestMentions() map[string]*gtsmodel.Mention { return map[string]*gtsmodel.Mention{ |