aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-09-25 13:20:48 +0000
committerrinpatch <rinpatch@sdf.org>2019-09-25 13:20:48 +0000
commit1ddd403339655674ca634a876151c4346c87c515 (patch)
treea6916ca96bbdbbb0dc2e6c627f309a723b605a99
parentd87be2ec96912b147ad8fb6b17c1ee00d7d30a7f (diff)
downloadpleroma-1ddd403339655674ca634a876151c4346c87c515.tar.gz
Apply suggestion to lib/pleroma/web/activity_pub/activity_pub_controller.ex
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub_controller.ex33
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex
index c3e7edf57..aa1620009 100644
--- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex
@@ -234,22 +234,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)