Unverified Commit da904ac0 authored by Benjamin Neff's avatar Benjamin Neff
Browse files

Merge pull request #7503 from SuperTux88/quickfix-multi-stream-ignore-users-with-tags

Exclude ignored people from followed tags when building stream-relation
parents 35e9faf5 a4c26b74
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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)
+1 −1
Original line number Diff line number Diff line
@@ -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
+12 −0
Original line number Diff line number Diff line
@@ -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