Fix tests.
This commit is contained in:
parent
c8d418acdd
commit
9aabff4883
@ -40,18 +40,23 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def stream_out(activity) do
|
def stream_out(activity) do
|
||||||
|
public = "https://www.w3.org/ns/activitystreams#Public"
|
||||||
|
|
||||||
if activity.data["type"] in ["Create", "Announce"] do
|
if activity.data["type"] in ["Create", "Announce"] do
|
||||||
Pleroma.Web.Streamer.stream("user", activity)
|
Pleroma.Web.Streamer.stream("user", activity)
|
||||||
|
|
||||||
visibility = Pleroma.Web.MastodonAPI.StatusView.get_visibility(activity.data["object"])
|
if Enum.member?(activity.data["to"], public) do
|
||||||
|
Pleroma.Web.Streamer.stream("public", activity)
|
||||||
|
|
||||||
case visibility do
|
if activity.local do
|
||||||
"public" ->
|
Pleroma.Web.Streamer.stream("public:local", activity)
|
||||||
Pleroma.Web.Streamer.stream("public", activity)
|
end
|
||||||
if activity.local, do: Pleroma.Web.Streamer.stream("public:local", activity)
|
else
|
||||||
|
if !Enum.member?(activity.data["cc"] || [], public) &&
|
||||||
"direct" ->
|
!Enum.member?(
|
||||||
Pleroma.Web.Streamer.stream("direct", activity)
|
activity.data["to"],
|
||||||
|
User.get_by_ap_id(activity.data["actor"]).follower_address
|
||||||
|
), do: Pleroma.Web.Streamer.stream("direct", activity)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -195,6 +195,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||||||
cond do
|
cond do
|
||||||
public in to -> "public"
|
public in to -> "public"
|
||||||
public in cc -> "unlisted"
|
public in cc -> "unlisted"
|
||||||
|
# this should use the sql for the object's activity
|
||||||
Enum.any?(to, &String.contains?(&1, "/followers")) -> "private"
|
Enum.any?(to, &String.contains?(&1, "/followers")) -> "private"
|
||||||
true -> "direct"
|
true -> "direct"
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user