salmon fix
authorAlex S <alex.strizhakov@gmail.com>
Sun, 16 Jun 2019 10:49:24 +0000 (18:49 +0800)
committerAlex S <alex.strizhakov@gmail.com>
Sun, 16 Jun 2019 12:10:12 +0000 (20:10 +0800)
removed some ownership sandbox error

lib/pleroma/web/salmon/salmon.ex
test/object/containment_test.exs
test/support/http_request_mock.ex

index 9e91a5a4061e9b769d3c90f0eb670d5ae3899442..e96e4e1e411e489ace59316c5fcebdb8d1e1ab4f 100644 (file)
@@ -146,7 +146,7 @@ defmodule Pleroma.Web.Salmon do
         do: Instances.set_reachable(url)
 
       Logger.debug(fn -> "Pushed to #{url}, code #{code}" end)
-      :ok
+      {:ok, code}
     else
       e ->
         unless params[:unreachable_since], do: Instances.set_reachable(url)
index a7a046203a5d24ef5b8aed51f0b2fed89654dde0..a860355b8e21eff9a64d8f8a8f1692f56f8daf33 100644 (file)
@@ -5,6 +5,7 @@ defmodule Pleroma.Object.ContainmentTest do
   alias Pleroma.User
 
   import Pleroma.Factory
+  import ExUnit.CaptureLog
 
   setup_all do
     Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
@@ -57,7 +58,10 @@ defmodule Pleroma.Object.ContainmentTest do
           follower_address: User.ap_followers(%User{nickname: "rye@niu.moe"})
         })
 
-      {:error, _} = User.get_or_fetch_by_ap_id("https://n1u.moe/users/rye")
+      assert capture_log(fn ->
+               {:error, _} = User.get_or_fetch_by_ap_id("https://n1u.moe/users/rye")
+             end) =~
+               "[error] Could not decode user at fetch https://n1u.moe/users/rye, {:error, :error}"
     end
   end
 end
index 67ef0928a1afaf7392b2180faedd82a7c0fc2b96..f7f55a11ae9e12b778599dc21330a0bba0da77b3 100644 (file)
@@ -802,6 +802,30 @@ defmodule HttpRequestMock do
      }}
   end
 
+  def post("http://mastodon.example.org/inbox", _, _, _) do
+    {:ok,
+     %Tesla.Env{
+       status: 200,
+       body: ""
+     }}
+  end
+
+  def post("https://hubzilla.example.org/inbox", _, _, _) do
+    {:ok,
+     %Tesla.Env{
+       status: 200,
+       body: ""
+     }}
+  end
+
+  def post("http://gs.example.org/index.php/main/salmon/user/1", _, _, _) do
+    {:ok,
+     %Tesla.Env{
+       status: 200,
+       body: ""
+     }}
+  end
+
   def post("http://200.site" <> _, _, _, _) do
     {:ok,
      %Tesla.Env{