diff --git a/Changelog.md b/Changelog.md index c4ac236a4a8110cec42f200325f492aac4fb6dbb..1860999607cd3ae3a071d3cc16eeb7a13bb0c6b4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -21,6 +21,7 @@ Ruby 2.1 is no longer officially supported. ## Bug fixes * Fix height too high on mobile SPV [#7480](https://github.com/diaspora/diaspora/pull/7480) +* Improve stream when ignoring a person who posts a lot of tagged posts [#7503](https://github.com/diaspora/diaspora/pull/7503) ## Features * Add support for mentions in comments to the backend [#6818](https://github.com/diaspora/diaspora/pull/6818) diff --git a/lib/evil_query.rb b/lib/evil_query.rb index 78599ead13f6635ae2cc87449919ed5e6435fb5b..782833a92dd78923af9ca2f8fa88c1e566253eec 100644 --- a/lib/evil_query.rb +++ b/lib/evil_query.rb @@ -71,7 +71,7 @@ module EvilQuery def followed_tags_posts! logger.debug("[EVIL-QUERY] followed_tags_posts!") - StatusMessage.public_tag_stream(@user.followed_tag_ids) + StatusMessage.public_tag_stream(@user.followed_tag_ids).excluding_hidden_content(@user) end def mentioned_posts diff --git a/spec/lib/evil_query_spec.rb b/spec/lib/evil_query_spec.rb index 082cccead34a81b8d8b4d1be9c045e02d2bcd107..dbaaf3b02e9164661c3d754ca8a194935409a2ad 100644 --- a/spec/lib/evil_query_spec.rb +++ b/spec/lib/evil_query_spec.rb @@ -28,6 +28,18 @@ describe EvilQuery::MultiStream do expect(evil_query.make_relation!.map(&:id)).not_to include(public_post.id) expect(evil_query.make_relation!.map(&:id)).not_to include(private_post.id) end + + it "doesn't include posts with tags from ignored users" do + tag = ActsAsTaggableOn::Tag.find_or_create_by(name: "test") + alice.tag_followings.create(tag_id: tag.id) + alice.blocks.create(person_id: eve.person_id) + + bob_post = bob.post(:status_message, text: "public #test post 1", to: "all", public: true) + eve_post = eve.post(:status_message, text: "public #test post 2", to: "all", public: true) + + expect(evil_query.make_relation!.map(&:id)).to include(bob_post.id) + expect(evil_query.make_relation!.map(&:id)).not_to include(eve_post.id) + end end end