From da621f792d0afbeea96d00e08d72daa9d313442d Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sun, 18 Oct 2020 04:15:47 -0700 Subject: [PATCH] dedupe collections in network --- app/controllers/page_collections_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/page_collections_controller.rb b/app/controllers/page_collections_controller.rb index 750fd96d..31a5cbed 100644 --- a/app/controllers/page_collections_controller.rb +++ b/app/controllers/page_collections_controller.rb @@ -15,8 +15,10 @@ class PageCollectionsController < ApplicationController @collections_with_pending = PageCollection.where(id: pending_submissions.pluck(:page_collection_id)) followed_user_ids = UserFollowing.where(user_id: current_user.id).pluck(:followed_user_id) - @network_collections = PageCollection.where(user_id: followed_user_ids, privacy: 'public') @followed_collections = current_user.followed_page_collections + @network_collections = PageCollection.where(user_id: followed_user_ids, privacy: 'public').where.not( + id: @followed_collections.pluck(:id) + ) @random_collections = PageCollection.where(privacy: 'public').where.not( id: @my_collections.pluck(:id) + @network_collections.pluck(:id) + @followed_collections.pluck(:id)