diff options
author | rinpatch <rinpatch@sdf.org> | 2019-04-18 12:56:38 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-04-18 12:56:38 +0300 |
commit | 83589ca6a56ed4ff6d7e9a116fbbf1797ba50e39 (patch) | |
tree | 48f28e164bdb18687fd9d6d52b39b996da889468 | |
parent | ac04311b3f0a611b5008747037d6cd5874fa3ae9 (diff) | |
parent | 8c65b69d4a536311347a27f85198d2883fcd03b8 (diff) | |
download | pleroma-83589ca6a56ed4ff6d7e9a116fbbf1797ba50e39.tar.gz |
Merge branch 'develop' into feature/database-compaction
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 2 | ||||
-rw-r--r-- | test/web/activity_pub/activity_pub_test.exs | 23 |
3 files changed, 25 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d2ad3320..21ad83a01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Configuration: `safe_dm_mentions` option - Configuration: `link_name` option - Configuration: `fetch_initial_posts` option +- Configuration: `notify_email` option - Pleroma API: User subscribtions - Admin API: Endpoints for listing/revoking invite tokens - Admin API: Endpoints for making users follow/unfollow each other diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 03be8b06f..9e2574419 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -727,7 +727,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do from( activity in query, where: fragment("not (? = ANY(?))", activity.actor, ^blocks), - where: fragment("not (?->'to' \\?| ?)", activity.data, ^blocks), + where: fragment("not (? && ?)", activity.recipients, ^blocks), where: fragment("not (split_part(?, '/', 3) = ANY(?))", activity.actor, ^domain_blocks) ) end diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index aacafc60a..02ced6ab2 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -347,6 +347,29 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do assert Enum.member?(activities, activity_one) end + test "doesn't return transitive interactions concerning blocked users" do + blocker = insert(:user) + blockee = insert(:user) + friend = insert(:user) + + {:ok, blocker} = User.block(blocker, blockee) + + {:ok, activity_one} = CommonAPI.post(friend, %{"status" => "hey!"}) + + {:ok, activity_two} = CommonAPI.post(friend, %{"status" => "hey! @#{blockee.nickname}"}) + + {:ok, activity_three} = CommonAPI.post(blockee, %{"status" => "hey! @#{friend.nickname}"}) + + {:ok, activity_four} = CommonAPI.post(blockee, %{"status" => "hey! @#{blocker.nickname}"}) + + activities = ActivityPub.fetch_activities([], %{"blocking_user" => blocker}) + + assert Enum.member?(activities, activity_one) + refute Enum.member?(activities, activity_two) + refute Enum.member?(activities, activity_three) + refute Enum.member?(activities, activity_four) + end + test "doesn't return muted activities" do activity_one = insert(:note_activity) activity_two = insert(:note_activity) |