diff options
Diffstat (limited to 'internal/federation/dereferencing')
4 files changed, 10 insertions, 7 deletions
diff --git a/internal/federation/dereferencing/account.go b/internal/federation/dereferencing/account.go index ec8d274a4..04efc464f 100644 --- a/internal/federation/dereferencing/account.go +++ b/internal/federation/dereferencing/account.go @@ -372,7 +372,7 @@ func (d *deref) enrichAccount(ctx context.Context, requestUser string, uri *url. } // Convert the dereferenced AP account object to our GTS model. - latestAcc, err := d.typeConverter.ASRepresentationToAccount(ctx, + latestAcc, err := d.converter.ASRepresentationToAccount(ctx, apubAcc, account.Domain, ) diff --git a/internal/federation/dereferencing/dereferencer.go b/internal/federation/dereferencing/dereferencer.go index 8beba9947..6248aa2c1 100644 --- a/internal/federation/dereferencing/dereferencer.go +++ b/internal/federation/dereferencing/dereferencer.go @@ -85,7 +85,7 @@ type Dereferencer interface { type deref struct { state *state.State - typeConverter typeutils.TypeConverter + converter *typeutils.Converter transportController transport.Controller mediaManager *media.Manager derefAvatars map[string]*media.ProcessingMedia @@ -99,10 +99,10 @@ type deref struct { } // NewDereferencer returns a Dereferencer initialized with the given parameters. -func NewDereferencer(state *state.State, typeConverter typeutils.TypeConverter, transportController transport.Controller, mediaManager *media.Manager) Dereferencer { +func NewDereferencer(state *state.State, converter *typeutils.Converter, transportController transport.Controller, mediaManager *media.Manager) Dereferencer { return &deref{ state: state, - typeConverter: typeConverter, + converter: converter, transportController: transportController, mediaManager: mediaManager, derefAvatars: make(map[string]*media.ProcessingMedia), diff --git a/internal/federation/dereferencing/dereferencer_test.go b/internal/federation/dereferencing/dereferencer_test.go index 6e9aa729c..1fefc1db9 100644 --- a/internal/federation/dereferencing/dereferencer_test.go +++ b/internal/federation/dereferencing/dereferencer_test.go @@ -25,6 +25,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/state" "github.com/superseriousbusiness/gotosocial/internal/storage" + "github.com/superseriousbusiness/gotosocial/internal/typeutils" "github.com/superseriousbusiness/gotosocial/internal/visibility" "github.com/superseriousbusiness/gotosocial/testrig" ) @@ -63,17 +64,19 @@ func (suite *DereferencerStandardTestSuite) SetupTest() { suite.db = testrig.NewTestDB(&suite.state) + converter := typeutils.NewConverter(&suite.state) + testrig.StartTimelines( &suite.state, visibility.NewFilter(&suite.state), - testrig.NewTestTypeConverter(suite.db), + converter, ) suite.storage = testrig.NewInMemoryStorage() suite.state.DB = suite.db suite.state.Storage = suite.storage media := testrig.NewTestMediaManager(&suite.state) - suite.dereferencer = dereferencing.NewDereferencer(&suite.state, testrig.NewTestTypeConverter(suite.db), testrig.NewTestTransportController(&suite.state, testrig.NewMockHTTPClient(nil, "../../../testrig/media")), media) + suite.dereferencer = dereferencing.NewDereferencer(&suite.state, converter, testrig.NewTestTransportController(&suite.state, testrig.NewMockHTTPClient(nil, "../../../testrig/media")), media) testrig.StandardDBSetup(suite.db, nil) } diff --git a/internal/federation/dereferencing/status.go b/internal/federation/dereferencing/status.go index 8586884eb..5ec04175e 100644 --- a/internal/federation/dereferencing/status.go +++ b/internal/federation/dereferencing/status.go @@ -263,7 +263,7 @@ func (d *deref) enrichStatus( // ActivityPub model was recently dereferenced, so assume that passed status // may contain out-of-date information, convert AP model to our GTS model. - latestStatus, err := d.typeConverter.ASStatusToStatus(ctx, apubStatus) + latestStatus, err := d.converter.ASStatusToStatus(ctx, apubStatus) if err != nil { return nil, nil, gtserror.Newf("error converting statusable to gts model for status %s: %w", uri, err) } |