diff options
author | Claire <claire.github-309c@sitedethib.com> | 2023-09-25 15:06:43 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2023-10-10 13:51:14 +0200 |
commit | e5772c9e55bf7f1d4a8c196e2d0d4fff01b0e452 (patch) | |
tree | 1f05a38e72bcb37f375f714eae95818d1e840ced | |
parent | 89f98f4b636f017ef12f9bd0eccf9ff1f5905149 (diff) |
Fix inefficient queries in “Follows and followers” as well as several admin pages (#27116)
-rw-r--r-- | app/models/relationship_filter.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/relationship_filter.rb b/app/models/relationship_filter.rb index 249fe3df8e1..dae4e87b7d6 100644 --- a/app/models/relationship_filter.rb +++ b/app/models/relationship_filter.rb @@ -60,13 +60,13 @@ class RelationshipFilter def relationship_scope(value) case value when 'following' - account.following.eager_load(:account_stat).reorder(nil) + account.following.includes(:account_stat).reorder(nil) when 'followed_by' - account.followers.eager_load(:account_stat).reorder(nil) + account.followers.includes(:account_stat).reorder(nil) when 'mutual' - account.followers.eager_load(:account_stat).reorder(nil).merge(Account.where(id: account.following)) + account.followers.includes(:account_stat).reorder(nil).merge(Account.where(id: account.following)) when 'invited' - Account.joins(user: :invite).merge(Invite.where(user: account.user)).eager_load(:account_stat).reorder(nil) + Account.joins(user: :invite).merge(Invite.where(user: account.user)).includes(:account_stat).reorder(nil) else raise Mastodon::InvalidParameterError, "Unknown relationship: #{value}" end |