Formatting fixes.
authorlain <lain@soykaf.club>
Sat, 21 Apr 2018 07:43:53 +0000 (09:43 +0200)
committerlain <lain@soykaf.club>
Sat, 21 Apr 2018 07:43:53 +0000 (09:43 +0200)
lib/pleroma/web/activity_pub/transmogrifier.ex
lib/pleroma/web/activity_pub/utils.ex
lib/pleroma/web/oauth/oauth_controller.ex
lib/pleroma/web/ostatus/activity_representer.ex
lib/pleroma/web/web_finger/web_finger.ex
test/web/activity_pub/transmogrifier_test.exs

index 00b9f74ff34af9327b1448c3acdf297bf8806c2c..2871a2544738086cffe934707c2359f9ec386aa5 100644 (file)
@@ -146,7 +146,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
         %{"type" => "Like", "object" => object_id, "actor" => actor, "id" => id} = data
       ) do
     with %User{} = actor <- User.get_or_fetch_by_ap_id(actor),
-         {:ok, object} <- get_obj_helper(object_id) || ActivityPub.fetch_object_from_id(object_id),
+         {:ok, object} <-
+           get_obj_helper(object_id) || ActivityPub.fetch_object_from_id(object_id),
          {:ok, activity, object} <- ActivityPub.like(actor, object, id, false) do
       {:ok, activity}
     else
@@ -158,7 +159,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
         %{"type" => "Announce", "object" => object_id, "actor" => actor, "id" => id} = data
       ) do
     with %User{} = actor <- User.get_or_fetch_by_ap_id(actor),
-         {:ok, object} <- get_obj_helper(object_id) || ActivityPub.fetch_object_from_id(object_id),
+         {:ok, object} <-
+           get_obj_helper(object_id) || ActivityPub.fetch_object_from_id(object_id),
          {:ok, activity, object} <- ActivityPub.announce(actor, object, id, false) do
       {:ok, activity}
     else
@@ -209,7 +211,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
       end
 
     with %User{} = actor <- User.get_or_fetch_by_ap_id(actor),
-         {:ok, object} <- get_obj_helper(object_id) || ActivityPub.fetch_object_from_id(object_id),
+         {:ok, object} <-
+           get_obj_helper(object_id) || ActivityPub.fetch_object_from_id(object_id),
          {:ok, activity} <- ActivityPub.delete(object, false) do
       {:ok, activity}
     else
index 7a0762e9f17fc7bb0bc1d49634105dcb1905faea..7b2bf8fa7cc5f437001a2cfc477dd0020d8ea66c 100644 (file)
@@ -175,7 +175,8 @@ defmodule Pleroma.Web.ActivityPub.Utils do
 
   def update_element_in_object(property, element, object) do
     with new_data <-
-           object.data |> Map.put("#{property}_count", length(element))
+           object.data
+           |> Map.put("#{property}_count", length(element))
            |> Map.put("#{property}s", element),
          changeset <- Changeset.change(object, data: new_data),
          {:ok, object} <- Repo.update(changeset),
index 6297b7baeca9039e89335c5f21234808124dbcb5..11dc1806f62b6488f6d34a27592198458a81c902 100644 (file)
@@ -63,7 +63,8 @@ defmodule Pleroma.Web.OAuth.OAuthController do
              client_secret: params["client_secret"]
            ),
          fixed_token = fix_padding(params["code"]),
-         %Authorization{} = auth <- Repo.get_by(Authorization, token: fixed_token, app_id: app.id),
+         %Authorization{} = auth <-
+           Repo.get_by(Authorization, token: fixed_token, app_id: app.id),
          {:ok, token} <- Token.exchange_token(app, auth) do
       response = %{
         token_type: "Bearer",
index 2f28c456e941281104d711d03272482036039055..921a89bd015fca545652f3c0f202996e0d220080 100644 (file)
@@ -131,7 +131,8 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
        h.(activity.data["object"]["content"] |> String.replace(~r/[\n\r]/, ""))},
       {:published, h.(inserted_at)},
       {:updated, h.(updated_at)},
-      {:"ostatus:conversation", [ref: h.(activity.data["context"])], h.(activity.data["context"])},
+      {:"ostatus:conversation", [ref: h.(activity.data["context"])],
+       h.(activity.data["context"])},
       {:link, [ref: h.(activity.data["context"]), rel: 'ostatus:conversation'], []}
     ] ++
       summary ++
@@ -162,7 +163,8 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
          # For notes, federate the object id.
          {:id, h.(activity.data["object"])}
        ]},
-      {:"ostatus:conversation", [ref: h.(activity.data["context"])], h.(activity.data["context"])},
+      {:"ostatus:conversation", [ref: h.(activity.data["context"])],
+       h.(activity.data["context"])},
       {:link, [ref: h.(activity.data["context"]), rel: 'ostatus:conversation'], []},
       {:link, [rel: 'self', type: ['application/atom+xml'], href: h.(activity.data["id"])], []},
       {:"thr:in-reply-to", [ref: to_charlist(activity.data["object"])], []}
@@ -193,7 +195,8 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
       {:content, [type: 'html'], ['RT #{retweeted_activity.data["object"]["content"]}']},
       {:published, h.(inserted_at)},
       {:updated, h.(updated_at)},
-      {:"ostatus:conversation", [ref: h.(activity.data["context"])], h.(activity.data["context"])},
+      {:"ostatus:conversation", [ref: h.(activity.data["context"])],
+       h.(activity.data["context"])},
       {:link, [ref: h.(activity.data["context"]), rel: 'ostatus:conversation'], []},
       {:link, [rel: 'self', type: ['application/atom+xml'], href: h.(activity.data["id"])], []},
       {:"activity:object", retweeted_xml}
index e45c0ed8d33385acdc936e61e36bd0ca50beb5bb..dc9ad2014216d425ac08b22993c00b6cb82c94d6 100644 (file)
@@ -81,7 +81,10 @@ defmodule Pleroma.Web.WebFinger do
           "href" => user.ap_id
         },
         %{"rel" => "salmon", "href" => OStatus.salmon_path(user)},
-        %{"rel" => "magic-public-key", "href" => "data:application/magic-public-key,#{magic_key}"},
+        %{
+          "rel" => "magic-public-key",
+          "href" => "data:application/magic-public-key,#{magic_key}"
+        },
         %{"rel" => "self", "type" => "application/activity+json", "href" => user.ap_id},
         %{
           "rel" => "http://ostatus.org/schema/1.0/subscribe",
index 060ebe9f10f04679fbb4bf4e0984cf6d6eb35f49..3dab597465d2b212ff9b6dabd230a1daaa3b1188 100644 (file)
@@ -102,7 +102,8 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
       user = insert(:user)
 
       data =
-        File.read!("test/fixtures/mastodon-follow-activity.json") |> Poison.decode!()
+        File.read!("test/fixtures/mastodon-follow-activity.json")
+        |> Poison.decode!()
         |> Map.put("object", user.ap_id)
 
       {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
@@ -118,7 +119,8 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
       {:ok, activity} = CommonAPI.post(user, %{"status" => "hello"})
 
       data =
-        File.read!("test/fixtures/mastodon-like.json") |> Poison.decode!()
+        File.read!("test/fixtures/mastodon-like.json")
+        |> Poison.decode!()
         |> Map.put("object", activity.data["object"]["id"])
 
       {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)