summaryrefslogtreecommitdiff
path: root/testrig
diff options
context:
space:
mode:
authorLibravatar nicole mikołajczyk <git@mkljczk.pl>2025-08-12 14:05:15 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-08-12 14:05:15 +0200
commit660cf2c94ce6a87ac33d704ab1f68b2d4a258d92 (patch)
tree03eeab55b2f3bc2f3fc7667d245ed3b561a4f1a4 /testrig
parent[docs] Revamp trusted proxies warning a bit (#4365) (diff)
downloadgotosocial-660cf2c94ce6a87ac33d704ab1f68b2d4a258d92.tar.xz
[feature] scheduled statuses (#4274)
An implementation of [`scheduled_statuses`](https://docs.joinmastodon.org/methods/scheduled_statuses/). Will fix #1006. this is heavily WIP and I need to reorganize some of the code, working on this made me somehow familiar with the codebase and led to my other recent contributions i told some fops on fedi i'd work on this so i have no choice but to complete it 🤷‍♀️ btw iirc my avatar presents me working on this branch Signed-off-by: nicole mikołajczyk <git@mkljczk.pl> Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4274 Co-authored-by: nicole mikołajczyk <git@mkljczk.pl> Co-committed-by: nicole mikołajczyk <git@mkljczk.pl>
Diffstat (limited to 'testrig')
-rw-r--r--testrig/config.go3
-rw-r--r--testrig/db.go6
-rw-r--r--testrig/testmodels.go15
3 files changed, 24 insertions, 0 deletions
diff --git a/testrig/config.go b/testrig/config.go
index 93d7fb554..991382bd2 100644
--- a/testrig/config.go
+++ b/testrig/config.go
@@ -140,6 +140,9 @@ func testDefaults() config.Configuration {
StatusesPollOptionMaxChars: 50,
StatusesMediaMaxFiles: 6,
+ ScheduledStatusesMaxTotal: 300,
+ ScheduledStatusesMaxDaily: 25,
+
LetsEncryptEnabled: false,
LetsEncryptPort: 0,
LetsEncryptCertDir: "",
diff --git a/testrig/db.go b/testrig/db.go
index dd65e0804..1b1f6549a 100644
--- a/testrig/db.go
+++ b/testrig/db.go
@@ -358,6 +358,12 @@ func StandardDBSetup(db db.DB, accounts map[string]*gtsmodel.Account) {
}
}
+ for _, v := range NewTestScheduledStatuses() {
+ if err := db.Put(ctx, v); err != nil {
+ log.Panic(ctx, err)
+ }
+ }
+
if err := db.CreateInstanceAccount(ctx); err != nil {
log.Panic(ctx, err)
}
diff --git a/testrig/testmodels.go b/testrig/testmodels.go
index 9bbebcc4e..b7d527010 100644
--- a/testrig/testmodels.go
+++ b/testrig/testmodels.go
@@ -4331,6 +4331,21 @@ func NewTestStatusEdits() map[string]*gtsmodel.StatusEdit {
}
}
+func NewTestScheduledStatuses() map[string]*gtsmodel.ScheduledStatus {
+ return map[string]*gtsmodel.ScheduledStatus{
+ "scheduled_status_1": {
+ ID: "01JZ399E8JF23TS0NEVY6J91KP",
+ AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", // local account 1,
+ ScheduledAt: TimeMustParse("2080-07-01T21:37:00+02:00"),
+ Text: ":neopapaj_woozy:",
+ Visibility: gtsmodel.VisibilityPublic,
+ Sensitive: util.Ptr(false),
+ Language: "pl",
+ ApplicationID: "01F8MGY43H3N2C8EWPR2FPYEXG",
+ },
+ }
+}
+
// 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