From 0f734a24100383171a866fccc194dea578141d74 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Fri, 2 Aug 2024 12:15:11 +0000 Subject: [chore] move PopulateAccountStats() nil check often performed into function itself (#3158) * move PopulateAccountStats() nil check often performed into function itself * fix test to take in mind we don't repopulate account stats if not-nil --- internal/federation/dereferencing/account.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'internal/federation') diff --git a/internal/federation/dereferencing/account.go b/internal/federation/dereferencing/account.go index 65436f9ea..3abf628d1 100644 --- a/internal/federation/dereferencing/account.go +++ b/internal/federation/dereferencing/account.go @@ -984,10 +984,8 @@ func (d *Dereferencer) dereferenceAccountStats( account *gtsmodel.Account, ) error { // Ensure we have a stats model for this account. - if account.Stats == nil { - if err := d.state.DB.PopulateAccountStats(ctx, account); err != nil { - return gtserror.Newf("db error getting account stats: %w", err) - } + if err := d.state.DB.PopulateAccountStats(ctx, account); err != nil { + return gtserror.Newf("db error getting account stats: %w", err) } // We want to update stats by getting remote -- cgit v1.3