Look through whole db for user timelines.
authorRoger Braun <rbraun@Bobble.local>
Wed, 8 Nov 2017 16:25:18 +0000 (17:25 +0100)
committerRoger Braun <rbraun@Bobble.local>
Wed, 8 Nov 2017 16:25:18 +0000 (17:25 +0100)
They already have an index that's good enough.

lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
lib/pleroma/web/twitter_api/twitter_api_controller.ex

index 4f7be4293332cb09bc75e86e337fe8a1589e7d62..e7d4c48bd1443c90742728ff7b7ce63e07f70daa 100644 (file)
@@ -157,6 +157,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
   defp restrict_favorited_by(query, _), do: query
 
   # Only search through last 100_000 activities by default
+  defp restrict_recent(query, %{"whole_db" => true}), do: query
   defp restrict_recent(query, _) do
     since = (Repo.aggregate(Activity, :max, :id) || 0) - 100_000
 
index 96cf39f1a4299467b119bbe13d745e647e3a11c6..feaf9a900d8a704138672104073ac4690c441097 100644 (file)
@@ -122,6 +122,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
       params = params
       |> Map.put("type", ["Create", "Announce"])
       |> Map.put("actor_id", ap_id)
+      |> Map.put("whole_db", true)
 
       activities = ActivityPub.fetch_activities([], params)
       |> Enum.reverse
index 2604b54dcdb55bd9739b784bac955935f93d210b..125eb8a1e9393f22dff4547ceef6faa96a671a09 100644 (file)
@@ -68,7 +68,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
   def user_timeline(%{assigns: %{user: user}} = conn, params) do
     case TwitterAPI.get_user(user, params) do
       {: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)
         conn
         |> json_reply(200, statuses |> Poison.encode!)