projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'origin/develop' into fix-slow-relationships
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
utils.ex
diff --git
a/lib/pleroma/web/activity_pub/utils.ex
b/lib/pleroma/web/activity_pub/utils.ex
index 77841278a3a63489b4ff3ebb17461343895108d3..0c614a8830f6d6b6db2733e17dc8f353b1939b31 100644
(file)
--- a/
lib/pleroma/web/activity_pub/utils.ex
+++ b/
lib/pleroma/web/activity_pub/utils.ex
@@
-404,13
+404,15
@@
defmodule Pleroma.Web.ActivityPub.Utils do
activity.data
),
where: activity.actor == ^follower_id,
activity.data
),
where: activity.actor == ^follower_id,
+ # this is to use the index
where:
fragment(
where:
fragment(
- "? @> ?",
+ "coalesce((?)->'object'->>'id', (?)->>'object') = ?",
+ activity.data,
activity.data,
activity.data,
- ^
%{object: followed_id}
+ ^
followed_id
),
),
- order_by: [
desc: :id
],
+ order_by: [
fragment("? desc nulls last", activity.id)
],
limit: 1
)
limit: 1
)
@@
-567,13
+569,15
@@
defmodule Pleroma.Web.ActivityPub.Utils do
activity.data
),
where: activity.actor == ^blocker_id,
activity.data
),
where: activity.actor == ^blocker_id,
+ # this is to use the index
where:
fragment(
where:
fragment(
- "? @> ?",
+ "coalesce((?)->'object'->>'id', (?)->>'object') = ?",
+ activity.data,
activity.data,
activity.data,
- ^
%{object: blocked_id}
+ ^
blocked_id
),
),
- order_by: [
desc: :id
],
+ order_by: [
fragment("? desc nulls last", activity.id)
],
limit: 1
)
limit: 1
)