Merge branch 'muting' into 'develop'

Don't stream muted accounts

See merge request pleroma/pleroma!888
This commit is contained in:
kaniini 2019-03-03 21:10:10 +00:00
commit dd5865535e
1 changed files with 5 additions and 2 deletions

View File

@ -197,10 +197,12 @@ def push_to_socket(topics, topic, %Activity{data: %{"type" => "Announce"}} = ite
if socket.assigns[:user] do if socket.assigns[:user] do
user = User.get_cached_by_ap_id(socket.assigns[:user].ap_id) user = User.get_cached_by_ap_id(socket.assigns[:user].ap_id)
blocks = user.info.blocks || [] blocks = user.info.blocks || []
mutes = user.info.mutes || []
parent = Object.normalize(item.data["object"]) parent = Object.normalize(item.data["object"])
unless is_nil(parent) or item.actor in blocks or parent.data["actor"] in blocks do unless is_nil(parent) or item.actor in blocks or item.actor in mutes or
parent.data["actor"] in blocks or parent.data["actor"] in mutes do
send(socket.transport_pid, {:text, represent_update(item, user)}) send(socket.transport_pid, {:text, represent_update(item, user)})
end end
else else
@ -224,8 +226,9 @@ def push_to_socket(topics, topic, item) do
if socket.assigns[:user] do if socket.assigns[:user] do
user = User.get_cached_by_ap_id(socket.assigns[:user].ap_id) user = User.get_cached_by_ap_id(socket.assigns[:user].ap_id)
blocks = user.info.blocks || [] blocks = user.info.blocks || []
mutes = user.info.mutes || []
unless item.actor in blocks do unless item.actor in blocks or item.actor in mutes do
send(socket.transport_pid, {:text, represent_update(item, user)}) send(socket.transport_pid, {:text, represent_update(item, user)})
end end
else else