A platform for community discussion. Free, open, simple.
DEV: small refactor of the category_moderators method (#12550)
Régis Hanolc847f5e8a167
diff --git a/app/models/about.rb b/app/models/about.rbindex 5631fbb9c9e..bf0ec3d2fb0 100644--- a/app/models/about.rb+++ b/app/models/about.rb@@ -103,10 +103,10 @@ class AboutORDER BY c.positionSQL- moderators = User.where(id: results.map(&:user_ids).flatten.uniq).map { |u| [u.id, u] }.to_h+ mods = User.where(id: results.map(&:user_ids).flatten.uniq).index_by(&:id)results.map do |row|- CategoryMods.new(row.category_id, row.user_ids.map { |id| moderators[id] })+ CategoryMods.new(row.category_id, mods.values_at(*row.user_ids))endend