Formatting.
authorlain <lain@soykaf.club>
Sat, 26 May 2018 13:11:50 +0000 (15:11 +0200)
committerlain <lain@soykaf.club>
Sat, 26 May 2018 13:11:50 +0000 (15:11 +0200)
lib/pleroma/web/activity_pub/transmogrifier.ex
test/web/activity_pub/transmogrifier_test.exs
test/web/mastodon_api/mastodon_api_controller_test.exs

index fee0b58596c186b82a4ccee37d589f161d96cc05..62667daa2bf0a35c129f3d673f81449c71a4869b 100644 (file)
@@ -166,6 +166,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
       # Can't find the activity. This might a Mastodon 2.3 "Accept"
       {:activity, nil} ->
         mastodon_follow_hack(follow_object, followed)
+
       _ ->
         {:error, nil}
     end
@@ -177,7 +178,14 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
     with %User{} = followed <- User.get_or_fetch_by_ap_id(actor),
          {:ok, follow_activity} <- get_follow_activity(follow_object, followed),
          %User{local: true} = follower <- User.get_cached_by_ap_id(follow_activity.data["actor"]),
-         {:ok, activity} <- ActivityPub.accept(%{to: follow_activity.data["to"], type: "Accept", actor: followed.ap_id, object: follow_activity.data["id"], local: false}) do
+         {:ok, activity} <-
+           ActivityPub.accept(%{
+             to: follow_activity.data["to"],
+             type: "Accept",
+             actor: followed.ap_id,
+             object: follow_activity.data["id"],
+             local: false
+           }) do
       if not User.following?(follower, followed) do
         {:ok, follower} = User.follow(follower, followed)
       end
@@ -194,7 +202,14 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
     with %User{} = followed <- User.get_or_fetch_by_ap_id(actor),
          {:ok, follow_activity} <- get_follow_activity(follow_object, followed),
          %User{local: true} = follower <- User.get_cached_by_ap_id(follow_activity.data["actor"]),
-         {:ok, activity} <- ActivityPub.accept(%{to: follow_activity.data["to"], type: "Accept", actor: followed.ap_id, object: follow_activity.data["id"], local: false}) do
+         {:ok, activity} <-
+           ActivityPub.accept(%{
+             to: follow_activity.data["to"],
+             type: "Accept",
+             actor: followed.ap_id,
+             object: follow_activity.data["id"],
+             local: false
+           }) do
       User.unfollow(follower, followed)
 
       {:ok, activity}
index 43395eef129be418ac0c56c0e06ac0bf4f94751a..38484409560e15184b37246f112ae561669b7bb3 100644 (file)
@@ -399,12 +399,12 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
         |> Poison.decode!()
         |> Map.put("actor", followed.ap_id)
 
-      object = accept_data["object"]
-      |> Map.put("actor", follower.ap_id)
-      |> Map.put("id", follow_activity.data["id"])
+      object =
+        accept_data["object"]
+        |> Map.put("actor", follower.ap_id)
+        |> Map.put("id", follow_activity.data["id"])
 
-      accept_data =
-        Map.put(accept_data, "object", object)
+      accept_data = Map.put(accept_data, "object", object)
 
       {:ok, activity} = Transmogrifier.handle_incoming(accept_data)
       refute activity.local
index 0f091b986351f7153032d687368657e8f92d1c28..936d271825766aec5652cec0800f93e7c972ac77 100644 (file)
@@ -298,7 +298,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
     test "list timeline", %{conn: conn} do
       user = insert(:user)
       other_user = insert(:user)
-      {:ok, activity_one} = TwitterAPI.create_status(user, %{"status" => "Marisa is cute."})
+      {:ok, _activity_one} = TwitterAPI.create_status(user, %{"status" => "Marisa is cute."})
       {:ok, activity_two} = TwitterAPI.create_status(other_user, %{"status" => "Marisa is cute."})
       {:ok, list} = Pleroma.List.create("name", user)
       {:ok, list} = Pleroma.List.follow(list, other_user)