mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-07 18:48:07 -06:00
[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
This commit is contained in:
parent
94e87610c4
commit
0f734a2410
8 changed files with 53 additions and 78 deletions
|
|
@ -70,11 +70,9 @@ func (p *Processor) OutboxGet(
|
|||
}
|
||||
|
||||
// Ensure we have stats for this account.
|
||||
if receivingAcct.Stats == nil {
|
||||
if err := p.state.DB.PopulateAccountStats(ctx, receivingAcct); err != nil {
|
||||
err := gtserror.Newf("error getting stats for account %s: %w", receivingAcct.ID, err)
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
if err := p.state.DB.PopulateAccountStats(ctx, receivingAcct); err != nil {
|
||||
err := gtserror.Newf("error getting stats for account %s: %w", receivingAcct.ID, err)
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
||||
var obj vocab.Type
|
||||
|
|
@ -200,11 +198,9 @@ func (p *Processor) FollowersGet(
|
|||
}
|
||||
|
||||
// Ensure we have stats for this account.
|
||||
if receivingAcct.Stats == nil {
|
||||
if err := p.state.DB.PopulateAccountStats(ctx, receivingAcct); err != nil {
|
||||
err := gtserror.Newf("error getting stats for account %s: %w", receivingAcct.ID, err)
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
if err := p.state.DB.PopulateAccountStats(ctx, receivingAcct); err != nil {
|
||||
err := gtserror.Newf("error getting stats for account %s: %w", receivingAcct.ID, err)
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
||||
var obj vocab.Type
|
||||
|
|
@ -314,11 +310,9 @@ func (p *Processor) FollowingGet(ctx context.Context, requestedUser string, page
|
|||
}
|
||||
|
||||
// Ensure we have stats for this account.
|
||||
if receivingAcct.Stats == nil {
|
||||
if err := p.state.DB.PopulateAccountStats(ctx, receivingAcct); err != nil {
|
||||
err := gtserror.Newf("error getting stats for account %s: %w", receivingAcct.ID, err)
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
if err := p.state.DB.PopulateAccountStats(ctx, receivingAcct); err != nil {
|
||||
err := gtserror.Newf("error getting stats for account %s: %w", receivingAcct.ID, err)
|
||||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
||||
var obj vocab.Type
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue