Merge remote-tracking branch 'origin' into validate-user-info
authorlain <lain@soykaf.club>
Fri, 30 Nov 2018 16:34:20 +0000 (17:34 +0100)
committerlain <lain@soykaf.club>
Fri, 30 Nov 2018 16:34:20 +0000 (17:34 +0100)
1  2 
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
lib/pleroma/web/router.ex
lib/pleroma/web/streamer.ex
lib/pleroma/web/websub/websub.ex

Simple merge
index 209450383868d8a3cc396337b1e42976018572d6,3065981571bf51f0d3584b491e76b035752c4800..99b8b7063a0433021839ebb98719eb65a670170c
@@@ -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
    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
Simple merge