FIX: Exclude duplicates when serializing users

FIX: Exclude duplicates when serializing users

A unique index is not appropriate here, because we deliberately store multiple records per user for audit purposes

diff --git a/app/models/post_policy.rb b/app/models/post_policy.rb
index 0633289..0ffe76c 100644
--- a/app/models/post_policy.rb
+++ b/app/models/post_policy.rb
@@ -13,6 +13,7 @@ class PostPolicy < ActiveRecord::Base
       .where(user_id: policy_group_users.map(&:id))
       .includes(:user)
       .map(&:user)
+      .uniq
   end
 
   def not_accepted_by

GitHub sha: f76c113e

1 Like