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
This commit is contained in:
lain 2020-09-15 12:21:38 +00:00 committed by rinpatch
parent 22d49993d9
commit bb70b231d0
2 changed files with 10 additions and 2 deletions

View file

@ -744,7 +744,7 @@ defp restrict_replies(query, %{exclude_replies: true}) do
end
defp restrict_replies(query, %{
reply_filtering_user: user,
reply_filtering_user: %User{} = user,
reply_visibility: "self"
}) do
from(
@ -760,7 +760,7 @@ defp restrict_replies(query, %{
end
defp restrict_replies(query, %{
reply_filtering_user: user,
reply_filtering_user: %User{} = user,
reply_visibility: "following"
}) do
from(

View file

@ -1773,6 +1773,14 @@ test "public timeline with default reply_visibility `self`", %{users: %{u1: user
|> 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