Apply suggestion to lib/pleroma/web/activity_pub/activity_pub_controller.ex
authorrinpatch <rinpatch@sdf.org>
Wed, 25 Sep 2019 13:20:48 +0000 (13:20 +0000)
committerrinpatch <rinpatch@sdf.org>
Thu, 26 Sep 2019 00:46:10 +0000 (03:46 +0300)
lib/pleroma/web/activity_pub/activity_pub_controller.ex

index 8069d64c9f4f892c7426d1f08c93158cfe8c7407..5a3a4d5d1f661b3aead01303567af2c7e73b7fda 100644 (file)
@@ -200,22 +200,23 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
   def outbox(conn, %{"nickname" => nickname, "page" => page?} = params)
       when page? in [true, "true"] do
     with %User{} = user <- User.get_cached_by_nickname(nickname),
-         {:ok, user} <- User.ensure_keys_present(user),
-         activities <-
-           (if params["max_id"] do
-              ActivityPub.fetch_user_activities(user, nil, %{
-                "max_id" => params["max_id"],
-                # This is a hack because postgres generates inefficient queries when filtering by 'Answer',
-                # poll votes will be hidden by the visibility filter in this case anyway
-                "include_poll_votes" => true,
-                "limit" => 10
-              })
-            else
-              ActivityPub.fetch_user_activities(user, nil, %{
-                "limit" => 10,
-                "include_poll_votes" => true
-              })
-            end) do
+         {:ok, user} <- User.ensure_keys_present(user) do
+      activities =
+        if params["max_id"] do
+          ActivityPub.fetch_user_activities(user, nil, %{
+            "max_id" => params["max_id"],
+            # This is a hack because postgres generates inefficient queries when filtering by 'Answer',
+            # poll votes will be hidden by the visibility filter in this case anyway
+            "include_poll_votes" => true,
+            "limit" => 10
+          })
+        else
+          ActivityPub.fetch_user_activities(user, nil, %{
+            "limit" => 10,
+            "include_poll_votes" => true
+          })
+        end
+
       conn
       |> put_resp_content_type("application/activity+json")
       |> put_view(UserView)