Mix format
authorSadposter <hannah+pleroma@coffee-and-dreams.uk>
Tue, 23 Jul 2019 14:13:05 +0000 (15:13 +0100)
committerSadposter <hannah+pleroma@coffee-and-dreams.uk>
Tue, 23 Jul 2019 14:13:05 +0000 (15:13 +0100)
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
test/web/mastodon_api/mastodon_api_controller_test.exs

index ccebcd415ac199d459049c03488ff99fc84c2601..9269a5a29a7e6e326a42e0fe66f7a6de267df86c 100644 (file)
@@ -885,11 +885,13 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
       q = from(u in User, where: u.ap_id in ^likes)
 
       users = Repo.all(q)
-      users = if is_nil(user) do
-        users
-      else
-        Enum.filter(users, &(not User.blocks?(user, &1)))
-      end
+
+      users =
+        if is_nil(user) do
+          users
+        else
+          Enum.filter(users, &(not User.blocks?(user, &1)))
+        end
 
       conn
       |> put_view(AccountView)
@@ -905,11 +907,13 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
       q = from(u in User, where: u.ap_id in ^announces)
 
       users = Repo.all(q)
-      users = if is_nil(user) do
-        users
-      else
-        Enum.filter(users, &(not User.blocks?(user, &1)))
-      end
+
+      users =
+        if is_nil(user) do
+          users
+        else
+          Enum.filter(users, &(not User.blocks?(user, &1)))
+        end
 
       conn
       |> put_view(AccountView)
index 00ca320d34ff1777a6e174e24d00bbcd5e6ece75..49650b1de10bf0f1deb4dd6d8da2746736e8547b 100644 (file)
@@ -3788,17 +3788,17 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
     end
 
     test "does not fail on an unauthententicated request", %{conn: conn, activity: activity} do
-        other_user = insert(:user)
-        {:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
+      other_user = insert(:user)
+      {:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
 
-        response =
-            conn
-            |> assign(:user, nil)
-            |> get("/api/v1/#{activity.id}/favourited_by")
-            |> json_response(:ok)
+      response =
+        conn
+        |> assign(:user, nil)
+        |> get("/api/v1/#{activity.id}/favourited_by")
+        |> json_response(:ok)
 
-        [%{"id" => id}] = response
-        assert id == other_user.id
+      [%{"id" => id}] = response
+      assert id == other_user.id
     end
   end
 
@@ -3859,17 +3859,17 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
     end
 
     test "does not fail on an unauthententicated request", %{conn: conn, activity: activity} do
-        other_user = insert(:user)
-        {:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
+      other_user = insert(:user)
+      {:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
 
-        response =
-            conn
-            |> assign(:user, nil)
-            |> get("/api/v1/#{activity.id}/reblogged_by")
-            |> json_response(:ok)
+      response =
+        conn
+        |> assign(:user, nil)
+        |> get("/api/v1/#{activity.id}/reblogged_by")
+        |> json_response(:ok)
 
-        [%{"id" => id}] = response
-        assert id == other_user.id
+      [%{"id" => id}] = response
+      assert id == other_user.id
     end
   end