MastodonAPI: Add streaming to media tabs of federated and local TLs

This commit is contained in:
Haelwenn (lanodan) Monnier 2018-06-17 15:01:27 +02:00
parent 25946f772d
commit b670d4d683
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE
2 changed files with 18 additions and 2 deletions

View File

@ -65,6 +65,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
if activity.local do
Pleroma.Web.Streamer.stream("public:local", activity)
end
if activity.data["object"]["attachment"] != [] do
Pleroma.Web.Streamer.stream("public:media", activity)
if activity.local do
Pleroma.Web.Streamer.stream("public:local:media", activity)
end
end
else
if !Enum.member?(activity.data["cc"] || [], public) &&
!Enum.member?(

View File

@ -15,8 +15,16 @@ defmodule Pleroma.Web.MastodonAPI.MastodonSocket do
with token when not is_nil(token) <- params["access_token"],
%Token{user_id: user_id} <- Repo.get_by(Token, token: token),
%User{} = user <- Repo.get(User, user_id),
stream when stream in ["public", "public:local", "user", "direct", "list"] <-
params["stream"] do
stream
when stream in [
"public",
"public:local",
"public:media",
"public:local:media",
"user",
"direct",
"list"
] <- params["stream"] do
topic = if stream == "list", do: "list:#{params["list"]}", else: stream
socket =