Make pagination type conditional

This commit is contained in:
Mark Felder 2020-12-30 16:37:04 -06:00
parent 085d4e6cfc
commit 2597b028f7

View file

@ -603,12 +603,18 @@ def fetch_user_activities(user, reading_user, params \\ %{}) do
|> Map.put(:muting_user, reading_user) |> Map.put(:muting_user, reading_user)
end end
pagination_type =
cond do
is_nil(params[:offset]) -> :keyset
true -> :offset
end
%{ %{
godmode: params[:godmode], godmode: params[:godmode],
reading_user: reading_user reading_user: reading_user
} }
|> user_activities_recipients() |> user_activities_recipients()
|> fetch_activities(params, :offset) |> fetch_activities(params, pagination_type)
|> Enum.reverse() |> Enum.reverse()
end end