From 8a2e1917c3b609412593fb36ed6375c48f0748f5 Mon Sep 17 00:00:00 2001 From: Mayel de Borniol Date: Wed, 8 Jan 2025 12:27:21 +0000 Subject: [PATCH] https://github.com/bonfire-networks/bonfire-app/issues/900 --- lib/activities.ex | 4 ++-- lib/feed_filters.ex | 1 + test/social/feeds_filter_circles_test.exs | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/activities.ex b/lib/activities.ex index b9ee360..8e332cf 100644 --- a/lib/activities.ex +++ b/lib/activities.ex @@ -1294,7 +1294,7 @@ defmodule Bonfire.Social.Activities do end end - def maybe_filter(query, {:circles, circle_ids}, opts) do + def maybe_filter(query, {:subject_circles, circle_ids}, opts) do case Types.uids(circle_ids, nil) do nil -> warn(circle_ids, "unrecognized circle_ids") @@ -1315,7 +1315,7 @@ defmodule Bonfire.Social.Activities do end end - def maybe_filter(query, {:exclude_circles, circle_ids}, opts) do + def maybe_filter(query, {:exclude_subject_circles, circle_ids}, opts) do case Types.uids(circle_ids, nil) do nil -> warn(circle_ids, "unrecognized circle_ids") diff --git a/lib/feed_filters.ex b/lib/feed_filters.ex index 2958702..04d05e7 100644 --- a/lib/feed_filters.ex +++ b/lib/feed_filters.ex @@ -20,6 +20,7 @@ defmodule Bonfire.Social.FeedFilters do field :subjects, StringList field :exclude_subjects, StringList field :subject_circles, StringList + field :exclude_subject_circles, StringList field :subject_types, AtomOrStringList field :exclude_subject_types, AtomOrStringList field :objects, StringList diff --git a/test/social/feeds_filter_circles_test.exs b/test/social/feeds_filter_circles_test.exs index 920b305..2d66fee 100644 --- a/test/social/feeds_filter_circles_test.exs +++ b/test/social/feeds_filter_circles_test.exs @@ -72,7 +72,7 @@ defmodule Bonfire.Social.FeedsCirclesFilterTest do refute FeedLoader.feed_contains?(feed, post_by_carl, current_user: user) end - test "`exclude_circles` filters out posts from members of a circle", %{ + test "`exclude_subject_circles` filters out posts from members of a circle", %{ user: user, circle: circle, post_by_alice: post_by_alice, @@ -80,7 +80,7 @@ defmodule Bonfire.Social.FeedsCirclesFilterTest do post_by_carl: post_by_carl } do # Load a feed excluding posts by members of the "friends" circle - feed = FeedLoader.feed(:custom, %{exclude_circles: [circle]}, current_user: user) + feed = FeedLoader.feed(:custom, %{exclude_subject_circles: [circle]}, current_user: user) # Assert posts by Alice (member of the circle) are excluded refute FeedLoader.feed_contains?(feed, post_by_alice, current_user: user) @@ -90,7 +90,7 @@ defmodule Bonfire.Social.FeedsCirclesFilterTest do end # TODO: optimise query with a special case that uses the same join for both? - test "`exclude_circles` and `circles` together prioritize exclusions", %{ + test "`exclude_subject_circles` and `circles` together prioritize exclusions", %{ user: user, carl: carl, circle: circle, @@ -106,7 +106,7 @@ defmodule Bonfire.Social.FeedsCirclesFilterTest do # Load a feed that includes "friends" circle but excludes "coworkers" circle feed = - FeedLoader.feed(:custom, %{circles: [circle], exclude_circles: [second_circle]}, + FeedLoader.feed(:custom, %{circles: [circle], exclude_subject_circles: [second_circle]}, current_user: user )