Apply suggestion to lib/pleroma/web/activity_pub/activity_pub_controller.ex

This commit is contained in:
rinpatch 2019-09-25 13:20:48 +00:00
parent d87be2ec96
commit 1ddd403339
1 changed files with 17 additions and 16 deletions

View File

@ -234,9 +234,9 @@ def followers(%{assigns: %{user: for_user}} = conn, %{"nickname" => nickname}) d
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
{: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',
@ -249,7 +249,8 @@ def outbox(conn, %{"nickname" => nickname, "page" => page?} = params)
"limit" => 10,
"include_poll_votes" => true
})
end) do
end
conn
|> put_resp_content_type("application/activity+json")
|> put_view(UserView)