def visible_for_user?(%{actor: ap_id}, %User{ap_id: ap_id}), do: true
- def visible_for_user?(%{data: %{"listMessage" => list_ap_id}}, %User{} = user) do
- list_ap_id
- |> Pleroma.List.get_by_ap_id()
- |> Pleroma.List.member?(user)
+ def visible_for_user?(%{data: %{"listMessage" => list_ap_id}} = activity, %User{} = user) do
+ user.ap_id in activity.data["to"] ||
+ list_ap_id
+ |> Pleroma.List.get_by_ap_id()
+ |> Pleroma.List.member?(user)
end
def visible_for_user?(%{data: %{"listMessage" => _}}, nil), do: false
end
end
- def get_to_and_cc(_user, _mentions, _inReplyTo, _), do: {[], []}
+ def get_to_and_cc(_user, mentions, _inReplyTo, {:list, _}), do: {mentions, []}
def get_addressed_users(_, to) when is_list(to) do
User.get_ap_ids_by_nicknames(to)
assert Visibility.visible_for_user?(direct, user)
assert Visibility.visible_for_user?(list, user)
- # All visible to a mentioned user, except when it's a list activity
+ # All visible to a mentioned user
assert Visibility.visible_for_user?(public, mentioned)
assert Visibility.visible_for_user?(private, mentioned)
assert Visibility.visible_for_user?(unlisted, mentioned)
assert Visibility.visible_for_user?(direct, mentioned)
- refute(Visibility.visible_for_user?(list, mentioned))
+ assert Visibility.visible_for_user?(list, mentioned)
# DM not visible for just follower