diff options
author | rinpatch <rinpatch@sdf.org> | 2020-05-27 13:45:14 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-05-27 13:45:14 +0000 |
commit | 91f73a7592049ffe2b1a99e86c6f4ee51218c768 (patch) | |
tree | 426d8723021aa80c8c85183b9a443468de205127 /lib | |
parent | b9e2678b9e1223f354d3a00a8c31b50807d8da62 (diff) | |
parent | 73f222d76a03e7bfad1aae80e0dc9d2777a94f3e (diff) | |
download | pleroma-91f73a7592049ffe2b1a99e86c6f4ee51218c768.tar.gz |
Merge branch 'notification-fixes' into 'develop'
Notification performance fixes
See merge request pleroma/pleroma!2595
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/notification.ex | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index 8aa9ed2d4..fb16ec896 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -92,8 +92,9 @@ defmodule Pleroma.Notification do |> join(:left, [n, a], object in Object, on: fragment( - "(?->>'id') = COALESCE((? -> 'object'::text) ->> 'id'::text)", + "(?->>'id') = COALESCE(?->'object'->>'id', ?->>'object')", object.data, + a.data, a.data ) ) @@ -224,18 +225,8 @@ defmodule Pleroma.Notification do |> Marker.multi_set_last_read_id(user, "notifications") |> Repo.transaction() - Notification + for_user_query(user) |> where([n], n.id in ^notification_ids) - |> join(:inner, [n], activity in assoc(n, :activity)) - |> join(:left, [n, a], object in Object, - on: - fragment( - "(?->>'id') = COALESCE((? -> 'object'::text) ->> 'id'::text)", - object.data, - a.data - ) - ) - |> preload([n, a, o], activity: {a, object: o}) |> Repo.all() end |