summaryrefslogtreecommitdiff
path: root/testrig/util.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-05-25 10:37:38 +0200
committerLibravatar GitHub <noreply@github.com>2023-05-25 10:37:38 +0200
commitf5c004d67d4ed66b6c6df100afec47174aa14ae0 (patch)
tree45b72a6e90450d711e10571d844138186fe023c9 /testrig/util.go
parent[docs] local docs hacking howto (#1816) (diff)
downloadgotosocial-f5c004d67d4ed66b6c6df100afec47174aa14ae0.tar.xz
[feature] Add List functionality (#1802)
* start working on lists * further list work * test list db functions nicely * more work on lists * peepoopeepoo * poke * start list timeline func * we're getting there lads * couldn't be me working on stuff... could it? * hook up handlers * fiddling * weeee * woah * screaming, pissing * fix streaming being a whiny baby * lint, small test fix, swagger * tidying up, testing * fucked! by the linter * move timelines to state like a boss * add timeline start to tests using state * invalidate lists
Diffstat (limited to 'testrig/util.go')
-rw-r--r--testrig/util.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/testrig/util.go b/testrig/util.go
index d7183df1c..4e52d12b5 100644
--- a/testrig/util.go
+++ b/testrig/util.go
@@ -20,6 +20,7 @@ package testrig
import (
"bytes"
"context"
+ "fmt"
"io"
"mime/multipart"
"net/url"
@@ -27,7 +28,11 @@ import (
"time"
"github.com/superseriousbusiness/gotosocial/internal/messages"
+ tlprocessor "github.com/superseriousbusiness/gotosocial/internal/processing/timeline"
"github.com/superseriousbusiness/gotosocial/internal/state"
+ "github.com/superseriousbusiness/gotosocial/internal/timeline"
+ "github.com/superseriousbusiness/gotosocial/internal/typeutils"
+ "github.com/superseriousbusiness/gotosocial/internal/visibility"
)
func StartWorkers(state *state.State) {
@@ -47,6 +52,28 @@ func StopWorkers(state *state.State) {
_ = state.Workers.Media.Stop()
}
+func StartTimelines(state *state.State, filter *visibility.Filter, typeConverter typeutils.TypeConverter) {
+ state.Timelines.Home = timeline.NewManager(
+ tlprocessor.HomeTimelineGrab(state),
+ tlprocessor.HomeTimelineFilter(state, filter),
+ tlprocessor.HomeTimelineStatusPrepare(state, typeConverter),
+ tlprocessor.SkipInsert(),
+ )
+ if err := state.Timelines.Home.Start(); err != nil {
+ panic(fmt.Sprintf("error starting home timeline: %s", err))
+ }
+
+ state.Timelines.List = timeline.NewManager(
+ tlprocessor.ListTimelineGrab(state),
+ tlprocessor.ListTimelineFilter(state, filter),
+ tlprocessor.ListTimelineStatusPrepare(state, typeConverter),
+ tlprocessor.SkipInsert(),
+ )
+ if err := state.Timelines.List.Start(); err != nil {
+ panic(fmt.Sprintf("error starting list timeline: %s", err))
+ }
+}
+
// CreateMultipartFormData is a handy function for taking a fieldname and a filename, and creating a multipart form bytes buffer
// with the file contents set in the given fieldname. The extraFields param can be used to add extra FormFields to the request, as necessary.
// The returned bytes.Buffer b can be used like so: