mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02: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:
@@ -113,13 +113,11 @@ func (c *Converter) AccountToAPIAccountSensitive(ctx context.Context, a *gtsmode
|
||||
}
|
||||
|
||||
// Ensure account stats populated.
|
||||
if a.Stats == nil {
|
||||
if err := c.state.DB.PopulateAccountStats(ctx, a); err != nil {
|
||||
return nil, gtserror.Newf(
|
||||
"error getting stats for account %s: %w",
|
||||
a.ID, err,
|
||||
)
|
||||
}
|
||||
if err := c.state.DB.PopulateAccountStats(ctx, a); err != nil {
|
||||
return nil, gtserror.Newf(
|
||||
"error getting stats for account %s: %w",
|
||||
a.ID, err,
|
||||
)
|
||||
}
|
||||
|
||||
// Populate the account's role permissions bitmap and highlightedness from its public role.
|
||||
|
Reference in New Issue
Block a user