Browse Source

Mastodon API: fix the public timeline returning an error when the `reply_visibility` parameter is set to `self` for an unauthenticated user

merge-requests/3010/head
eugenijm 3 years ago
parent
commit
3ab59a6f3c
3 changed files with 11 additions and 2 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +2
    -2
      lib/pleroma/web/activity_pub/activity_pub.ex
  3. +8
    -0
      test/web/activity_pub/activity_pub_test.exs

+ 1
- 0
CHANGELOG.md View File

@@ -24,6 +24,7 @@ switched to a new configuration mechanism, however it was not officially removed
### Fixed ### Fixed


- Welcome Chat messages preventing user registration with MRF Simple Policy applied to the local instance - 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 ## [2.1.1] - 2020-09-08




+ 2
- 2
lib/pleroma/web/activity_pub/activity_pub.ex View File

@@ -767,7 +767,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
end end


defp restrict_replies(query, %{ defp restrict_replies(query, %{
reply_filtering_user: user,
reply_filtering_user: %User{} = user,
reply_visibility: "self" reply_visibility: "self"
}) do }) do
from( from(
@@ -783,7 +783,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
end end


defp restrict_replies(query, %{ defp restrict_replies(query, %{
reply_filtering_user: user,
reply_filtering_user: %User{} = user,
reply_visibility: "following" reply_visibility: "following"
}) do }) do
from( from(


+ 8
- 0
test/web/activity_pub/activity_pub_test.exs View File

@@ -1810,6 +1810,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|> Enum.map(& &1.id) |> Enum.map(& &1.id)


assert activities_ids == [] assert activities_ids == []

activities_ids =
%{}
|> Map.put(:reply_visibility, "self")
|> Map.put(:reply_filtering_user, nil)
|> ActivityPub.fetch_public_activities()

assert activities_ids == []
end end


test "home timeline", %{users: %{u1: user}} do test "home timeline", %{users: %{u1: user}} do


Loading…
Cancel
Save