Look through whole db for user timelines.
They already have an index that's good enough.
This commit is contained in:
parent
36557155af
commit
d2430d5007
|
@ -157,6 +157,7 @@ defp restrict_favorited_by(query, %{"favorited_by" => ap_id}) do
|
||||||
defp restrict_favorited_by(query, _), do: query
|
defp restrict_favorited_by(query, _), do: query
|
||||||
|
|
||||||
# Only search through last 100_000 activities by default
|
# Only search through last 100_000 activities by default
|
||||||
|
defp restrict_recent(query, %{"whole_db" => true}), do: query
|
||||||
defp restrict_recent(query, _) do
|
defp restrict_recent(query, _) do
|
||||||
since = (Repo.aggregate(Activity, :max, :id) || 0) - 100_000
|
since = (Repo.aggregate(Activity, :max, :id) || 0) - 100_000
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,7 @@ def user_statuses(%{assigns: %{user: user}} = conn, params) do
|
||||||
params = params
|
params = params
|
||||||
|> Map.put("type", ["Create", "Announce"])
|
|> Map.put("type", ["Create", "Announce"])
|
||||||
|> Map.put("actor_id", ap_id)
|
|> Map.put("actor_id", ap_id)
|
||||||
|
|> Map.put("whole_db", true)
|
||||||
|
|
||||||
activities = ActivityPub.fetch_activities([], params)
|
activities = ActivityPub.fetch_activities([], params)
|
||||||
|> Enum.reverse
|
|> Enum.reverse
|
||||||
|
|
|
@ -68,7 +68,7 @@ def friends_timeline(%{assigns: %{user: user}} = conn, params) do
|
||||||
def user_timeline(%{assigns: %{user: user}} = conn, params) do
|
def user_timeline(%{assigns: %{user: user}} = conn, params) do
|
||||||
case TwitterAPI.get_user(user, params) do
|
case TwitterAPI.get_user(user, params) do
|
||||||
{:ok, target_user} ->
|
{:ok, target_user} ->
|
||||||
params = Map.merge(params, %{"actor_id" => target_user.ap_id})
|
params = Map.merge(params, %{"actor_id" => target_user.ap_id, "whole_db" => true})
|
||||||
statuses = TwitterAPI.fetch_user_statuses(user, params)
|
statuses = TwitterAPI.fetch_user_statuses(user, params)
|
||||||
conn
|
conn
|
||||||
|> json_reply(200, statuses |> Poison.encode!)
|
|> json_reply(200, statuses |> Poison.encode!)
|
||||||
|
|
Loading…
Reference in a new issue