diff options
author | lain <lain@soykaf.club> | 2020-09-15 12:21:38 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-09-15 12:21:38 +0000 |
commit | cfad4f46b2d53f67722f7b8046b673d60a9cefcd (patch) | |
tree | 5cda1c97243a93a32cf1282608a6d196b4272c29 | |
parent | 5c4ff5c73ce41f252e99a3c5c445efcecaa43dfe (diff) | |
parent | 3ab59a6f3c7b7bae2e69d1a8d1bf484d039a5420 (diff) | |
download | pleroma-cfad4f46b2d53f67722f7b8046b673d60a9cefcd.tar.gz |
Merge branch 'reply-visibility-user-guard' into 'develop'
Mastodon API: fix the public timeline returning an error when the `reply_visibility` parameter is set to `self` for an unauthenticated user
See merge request pleroma/pleroma!2999
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 4 | ||||
-rw-r--r-- | test/web/activity_pub/activity_pub_test.exs | 8 |
3 files changed, 11 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 82f64d441..f7a372e11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ switched to a new configuration mechanism, however it was not officially removed ### Fixed - Welcome Chat messages preventing user registration with MRF Simple Policy applied to the local instance +- Mastodon API: the public timeline returning an error when the `reply_visibility` parameter is set to `self` for an unauthenticated user ## [2.1.1] - 2020-09-08 diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 66a9f78a3..5aac3f53b 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -767,7 +767,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do end defp restrict_replies(query, %{ - reply_filtering_user: user, + reply_filtering_user: %User{} = user, reply_visibility: "self" }) do from( @@ -783,7 +783,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do end defp restrict_replies(query, %{ - reply_filtering_user: user, + reply_filtering_user: %User{} = user, reply_visibility: "following" }) do from( diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index d8caa0b00..7bdad3810 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -1810,6 +1810,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do |> Enum.map(& &1.id) assert activities_ids == [] + + activities_ids = + %{} + |> Map.put(:reply_visibility, "self") + |> Map.put(:reply_filtering_user, nil) + |> ActivityPub.fetch_public_activities() + + assert activities_ids == [] end test "home timeline", %{users: %{u1: user}} do |