From: lain Date: Fri, 30 Nov 2018 16:34:20 +0000 (+0100) Subject: Merge remote-tracking branch 'origin' into validate-user-info X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=d0ec2812bd347469ebce8a4606953bd6c901db80;p=akkoma Merge remote-tracking branch 'origin' into validate-user-info --- d0ec2812bd347469ebce8a4606953bd6c901db80 diff --cc lib/pleroma/web/streamer.ex index 209450383,306598157..99b8b7063 --- a/lib/pleroma/web/streamer.ex +++ b/lib/pleroma/web/streamer.ex @@@ -172,13 -186,17 +186,17 @@@ defmodule Pleroma.Web.Streamer d def push_to_socket(topics, topic, %Activity{data: %{"type" => "Announce"}} = item) do Enum.each(topics[topic] || [], fn socket -> # Get the current user so we have up-to-date blocks etc. - user = User.get_cached_by_ap_id(socket.assigns[:user].ap_id) - blocks = user.info.blocks || [] + if socket.assigns[:user] do + user = User.get_cached_by_ap_id(socket.assigns[:user].ap_id) - blocks = user.info["blocks"] || [] ++ blocks = user.info.blocks || [] - 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 - send(socket.transport_pid, {:text, represent_update(item, user)}) + unless is_nil(parent) or item.actor in blocks or parent.data["actor"] in blocks do + send(socket.transport_pid, {:text, represent_update(item, user)}) + end + else + send(socket.transport_pid, {:text, represent_update(item)}) end end) end @@@ -186,11 -204,15 +204,15 @@@ def push_to_socket(topics, topic, item) do Enum.each(topics[topic] || [], fn socket -> # Get the current user so we have up-to-date blocks etc. - user = User.get_cached_by_ap_id(socket.assigns[:user].ap_id) - blocks = user.info.blocks || [] - - unless item.actor in blocks do - send(socket.transport_pid, {:text, represent_update(item, user)}) + if socket.assigns[:user] do + user = User.get_cached_by_ap_id(socket.assigns[:user].ap_id) - blocks = user.info["blocks"] || [] ++ blocks = user.info.blocks || [] + + unless item.actor in blocks do + send(socket.transport_pid, {:text, represent_update(item, user)}) + end + else + send(socket.transport_pid, {:text, represent_update(item)}) end end) end