Add visibility check in context path

This commit is contained in:
FloatingGhost 2022-06-28 14:59:30 +01:00
parent e538102cf5
commit e58f2240d3

View file

@ -384,11 +384,13 @@ def reblogged_by(%{assigns: %{user: user}} = conn, %{id: id}) do
def context(%{assigns: %{user: user}} = conn, %{id: id}) do def context(%{assigns: %{user: user}} = conn, %{id: id}) do
with %Activity{} = activity <- Activity.get_by_id(id) do with %Activity{} = activity <- Activity.get_by_id(id) do
activities = activities =
ActivityPub.fetch_activities_for_context(activity.data["context"], %{ activity.data["context"]
|> ActivityPub.fetch_activities_for_context(%{
blocking_user: user, blocking_user: user,
user: user, user: user,
exclude_id: activity.id exclude_id: activity.id
}) })
|> Enum.filter(fn activity -> Visibility.visible_for_user?(activity, user) end)
render(conn, "context.json", activity: activity, activities: activities, user: user) render(conn, "context.json", activity: activity, activities: activities, user: user)
end end