FIX: Do not return muted child categories termless hashtag search (#19526)

We generally do not return muted child categories to the user
if they have muted the parent category, this commit respects that
rule for CategoryHashtagDataSource
This commit is contained in:
Martin Brennan
2022-12-20 13:45:03 +10:00
committed by GitHub
parent 94b258deda
commit 1b49a90e5b
2 changed files with 15 additions and 6 deletions

View File

@@ -91,6 +91,15 @@ RSpec.describe CategoryHashtagDataSource do
)
expect(described_class.search_without_term(guardian, 5).map(&:slug)).not_to include("random")
end
it "does not return child categories where the user has muted the parent" do
CategoryUser.create!(
user: user,
category: parent_category,
notification_level: CategoryUser.notification_levels[:muted],
)
expect(described_class.search_without_term(guardian, 5).map(&:slug)).not_to include("random")
end
end
describe "#search_sort" do