summaryrefslogtreecommitdiff
path: root/internal/typeutils
diff options
context:
space:
mode:
Diffstat (limited to 'internal/typeutils')
-rw-r--r--internal/typeutils/converter_test.go7
-rw-r--r--internal/typeutils/internaltofrontend.go6
2 files changed, 7 insertions, 6 deletions
diff --git a/internal/typeutils/converter_test.go b/internal/typeutils/converter_test.go
index b040b9854..88c0256c8 100644
--- a/internal/typeutils/converter_test.go
+++ b/internal/typeutils/converter_test.go
@@ -470,6 +470,7 @@ const (
type TypeUtilsTestSuite struct {
suite.Suite
db db.DB
+ state state.State
testAccounts map[string]*gtsmodel.Account
testStatuses map[string]*gtsmodel.Status
testAttachments map[string]*gtsmodel.MediaAttachment
@@ -482,13 +483,12 @@ type TypeUtilsTestSuite struct {
}
func (suite *TypeUtilsTestSuite) SetupSuite() {
- var state state.State
- state.Caches.Init()
+ suite.state.Caches.Init()
testrig.InitTestConfig()
testrig.InitTestLog()
- suite.db = testrig.NewTestDB(&state)
+ suite.db = testrig.NewTestDB(&suite.state)
suite.testAccounts = testrig.NewTestAccounts()
suite.testStatuses = testrig.NewTestStatuses()
suite.testAttachments = testrig.NewTestAttachments()
@@ -500,6 +500,7 @@ func (suite *TypeUtilsTestSuite) SetupSuite() {
}
func (suite *TypeUtilsTestSuite) SetupTest() {
+ suite.state.Caches.Init() // reset
testrig.StandardDBSetup(suite.db, nil)
}
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go
index bc42226ff..198bed099 100644
--- a/internal/typeutils/internaltofrontend.go
+++ b/internal/typeutils/internaltofrontend.go
@@ -59,7 +59,7 @@ func (c *converter) AccountToAPIAccountSensitive(ctx context.Context, a *gtsmode
// then adding the Source object to it...
// check pending follow requests aimed at this account
- frc, err := c.db.CountFollowRequests(ctx, "", a.ID)
+ frc, err := c.db.CountAccountFollowRequests(ctx, a.ID)
if err != nil {
return nil, fmt.Errorf("error counting follow requests: %s", err)
}
@@ -84,13 +84,13 @@ func (c *converter) AccountToAPIAccountSensitive(ctx context.Context, a *gtsmode
func (c *converter) AccountToAPIAccountPublic(ctx context.Context, a *gtsmodel.Account) (*apimodel.Account, error) {
// count followers
- followersCount, err := c.db.CountFollows(ctx, "", a.ID)
+ followersCount, err := c.db.CountAccountFollowers(ctx, a.ID)
if err != nil {
return nil, fmt.Errorf("error counting followers: %s", err)
}
// count following
- followingCount, err := c.db.CountFollows(ctx, a.ID, "")
+ followingCount, err := c.db.CountAccountFollows(ctx, a.ID)
if err != nil {
return nil, fmt.Errorf("error counting following: %s", err)
}