mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 18:52:25 -06:00
[feature] Rework timeline code to make it useful for more than just statuses (#373)
* add preparable and timelineable interfaces * initialize timeline manager within the processor * generic renaming * move status-specific timeline logic into the processor * refactor timeline to make it useful for more than statuses
This commit is contained in:
parent
98341a1d4d
commit
1b36e85840
26 changed files with 801 additions and 566 deletions
|
|
@ -23,6 +23,9 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/processing"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/timeline"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/visibility"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -41,10 +44,16 @@ func (suite *ManagerTestSuite) SetupTest() {
|
|||
|
||||
suite.db = testrig.NewTestDB()
|
||||
suite.tc = testrig.NewTestTypeConverter(suite.db)
|
||||
suite.filter = visibility.NewFilter(suite.db)
|
||||
|
||||
testrig.StandardDBSetup(suite.db, nil)
|
||||
|
||||
manager := testrig.NewTestTimelineManager(suite.db)
|
||||
manager := timeline.NewManager(
|
||||
processing.StatusGrabFunction(suite.db),
|
||||
processing.StatusFilterFunction(suite.db, suite.filter),
|
||||
processing.StatusPrepareFunction(suite.db, suite.tc),
|
||||
processing.StatusSkipInsertFunction(),
|
||||
)
|
||||
suite.manager = manager
|
||||
}
|
||||
|
||||
|
|
@ -78,12 +87,12 @@ func (suite *ManagerTestSuite) TestManagerIntegration() {
|
|||
suite.Equal("01F8MH75CBF9JFX4ZAD54N0W0R", oldestIndexed)
|
||||
|
||||
// get hometimeline
|
||||
statuses, err := suite.manager.HomeTimeline(context.Background(), testAccount.ID, "", "", "", 20, false)
|
||||
statuses, err := suite.manager.GetTimeline(context.Background(), testAccount.ID, "", "", "", 20, false)
|
||||
suite.NoError(err)
|
||||
suite.Len(statuses, 14)
|
||||
|
||||
// now wipe the last status from all timelines, as though it had been deleted by the owner
|
||||
err = suite.manager.WipeStatusFromAllTimelines(context.Background(), "01F8MH75CBF9JFX4ZAD54N0W0R")
|
||||
err = suite.manager.WipeItemFromAllTimelines(context.Background(), "01F8MH75CBF9JFX4ZAD54N0W0R")
|
||||
suite.NoError(err)
|
||||
|
||||
// timeline should be shorter
|
||||
|
|
@ -110,7 +119,7 @@ func (suite *ManagerTestSuite) TestManagerIntegration() {
|
|||
suite.Equal("01F8MHAAY43M6RJ473VQFCVH37", oldestIndexed)
|
||||
|
||||
// now remove all entries by local_account_2 from the timeline
|
||||
err = suite.manager.WipeStatusesFromAccountID(context.Background(), testAccount.ID, suite.testAccounts["local_account_2"].ID)
|
||||
err = suite.manager.WipeItemsFromAccountID(context.Background(), testAccount.ID, suite.testAccounts["local_account_2"].ID)
|
||||
suite.NoError(err)
|
||||
|
||||
// timeline should be shorter
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue