mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-18 07:48:19 +00:00
Make user timelines faster for users with few statuses.
This commit is contained in:
parent
9cda5b897a
commit
5e17e04144
|
@ -112,7 +112,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
|
||||
defp restrict_actor(query, %{"actor_id" => actor_id}) do
|
||||
from activity in query,
|
||||
where: fragment("? @> ?", activity.data, ^%{actor: actor_id})
|
||||
where: fragment("?->>'actor' = ?", activity.data, ^actor_id)
|
||||
end
|
||||
defp restrict_actor(query, _), do: query
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ defmodule Pleroma.Web.OStatus.OStatusController do
|
|||
def feed(conn, %{"nickname" => nickname}) do
|
||||
user = User.get_cached_by_nickname(nickname)
|
||||
query = from activity in Activity,
|
||||
where: fragment("? @> ?", activity.data, ^%{actor: user.ap_id}),
|
||||
where: fragment("?->>'actor' = ?", activity.data, ^user.ap_id),
|
||||
limit: 20,
|
||||
order_by: [desc: :inserted_at]
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
defmodule Pleroma.Repo.Migrations.AddActorIndexToActivity do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create index(:activities, ["(data->>'actor')", "inserted_at desc"], name: :activities_actor_index)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue