Browse Source

Use desc id to sort instead of desc inserted_at

Should mean the same and is indexed.
tags/v0.9.9
Roger Braun 6 years ago
parent
commit
678dd4c8ec
3 changed files with 3 additions and 3 deletions
  1. +1
    -1
      lib/pleroma/web/activity_pub/activity_pub.ex
  2. +1
    -1
      lib/pleroma/web/activity_pub/utils.ex
  3. +1
    -1
      lib/pleroma/web/ostatus/ostatus_controller.ex

+ 1
- 1
lib/pleroma/web/activity_pub/activity_pub.ex View File

@@ -97,7 +97,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
def fetch_activities_for_context(context) do
query = from activity in Activity,
where: fragment("?->>'type' = ? and ?->>'context' = ?", activity.data, "Create", activity.data, ^context),
order_by: [desc: :inserted_at]
order_by: [desc: :id]
Repo.all(query)
end



+ 1
- 1
lib/pleroma/web/activity_pub/utils.ex View File

@@ -152,7 +152,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
query = from activity in Activity,
where: fragment("? @> ?", activity.data, ^%{type: "Follow", actor: follower_id,
object: followed_id}),
order_by: [desc: :inserted_at],
order_by: [desc: :id],
limit: 1
Repo.one(query)
end


+ 1
- 1
lib/pleroma/web/ostatus/ostatus_controller.ex View File

@@ -21,7 +21,7 @@ defmodule Pleroma.Web.OStatus.OStatusController do
query = from activity in Activity,
where: fragment("?->>'actor' = ?", activity.data, ^user.ap_id),
limit: 20,
order_by: [desc: :inserted_at]
order_by: [desc: :id]

activities = query
|> Repo.all


Loading…
Cancel
Save