summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2020-09-21 15:29:55 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2020-09-21 15:29:55 +0000
commit994ce250c2c2a53eaca4b62c26fd4cb7667d6581 (patch)
tree97fe1e3a7af0688bdf1c2eb5d3a6e737bcc6db47
parent882c1fc6bdff4e27955730a412d73ead0e67a741 (diff)
parentf2f0a0260f00e316f62d42e766787b20cc92601a (diff)
Merge branch '2161-block-changes' into 'develop'
ActivityPub: Don't block-filter your own posts Closes #2161 See merge request pleroma/pleroma!3017
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub.ex9
-rw-r--r--test/web/mastodon_api/controllers/timeline_controller_test.exs12
2 files changed, 18 insertions, 3 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
index 06e8e1a7c..aacd58d03 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -841,7 +841,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
from(
[activity, object: o] in query,
where: fragment("not (? = ANY(?))", activity.actor, ^blocked_ap_ids),
- where: fragment("not (? && ?)", activity.recipients, ^blocked_ap_ids),
+ where:
+ fragment(
+ "((not (? && ?)) or ? = ?)",
+ activity.recipients,
+ ^blocked_ap_ids,
+ activity.actor,
+ ^user.ap_id
+ ),
where:
fragment(
"recipients_contain_blocked_domains(?, ?) = false",
diff --git a/test/web/mastodon_api/controllers/timeline_controller_test.exs b/test/web/mastodon_api/controllers/timeline_controller_test.exs
index 517cabcff..c6e0268fd 100644
--- a/test/web/mastodon_api/controllers/timeline_controller_test.exs
+++ b/test/web/mastodon_api/controllers/timeline_controller_test.exs
@@ -114,8 +114,16 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
{:ok, _reply_from_friend} =
CommonAPI.post(friend, %{status: "status", in_reply_to_status_id: reply_from_blockee})
- res_conn = get(conn, "/api/v1/timelines/public")
- [%{"id" => ^activity_id}] = json_response_and_validate_schema(res_conn, 200)
+ # Still shows replies from yourself
+ {:ok, %{id: reply_from_me}} =
+ CommonAPI.post(blocker, %{status: "status", in_reply_to_status_id: reply_from_blockee})
+
+ response =
+ get(conn, "/api/v1/timelines/public")
+ |> json_response_and_validate_schema(200)
+
+ assert length(response) == 2
+ [%{"id" => ^reply_from_me}, %{"id" => ^activity_id}] = response
end
test "doesn't return replies if follow is posting with users from blocked domain" do