Detect and try to stream incoming "direct" messages
This commit is contained in:
parent
ffe028cd73
commit
c60a5405db
@ -42,8 +42,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||||||
def stream_out(activity) do
|
def stream_out(activity) do
|
||||||
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)
|
||||||
|
direct? = activity.data["object"]["visibility"] == "direct"
|
||||||
|
|
||||||
if Enum.member?(activity.data["to"], "https://www.w3.org/ns/activitystreams#Public") do
|
cond do
|
||||||
|
direct? ->
|
||||||
|
Pleroma.Web.Streamer.stream("direct", activity)
|
||||||
|
|
||||||
|
Enum.member?(activity.data["to"], "https://www.w3.org/ns/activitystreams#Public") ->
|
||||||
Pleroma.Web.Streamer.stream("public", activity)
|
Pleroma.Web.Streamer.stream("public", activity)
|
||||||
|
|
||||||
if activity.local do
|
if activity.local do
|
||||||
|
@ -15,7 +15,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonSocket do
|
|||||||
with token when not is_nil(token) <- params["access_token"],
|
with token when not is_nil(token) <- params["access_token"],
|
||||||
%Token{user_id: user_id} <- Repo.get_by(Token, token: token),
|
%Token{user_id: user_id} <- Repo.get_by(Token, token: token),
|
||||||
%User{} = user <- Repo.get(User, user_id),
|
%User{} = user <- Repo.get(User, user_id),
|
||||||
stream when stream in ["public", "public:local", "user"] <- params["stream"] do
|
stream when stream in ["public", "public:local", "user", "direct"] <- params["stream"] do
|
||||||
socket =
|
socket =
|
||||||
socket
|
socket
|
||||||
|> assign(:topic, params["stream"])
|
|> assign(:topic, params["stream"])
|
||||||
|
Loading…
Reference in New Issue
Block a user