projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4cedf45
)
notification: preload child objects
author
William Pitcock
<nenolod@dereferenced.org>
Sat, 23 Mar 2019 02:19:34 +0000
(
02:19
+0000)
committer
William Pitcock
<nenolod@dereferenced.org>
Sat, 23 Mar 2019 02:28:57 +0000
(
02:28
+0000)
lib/pleroma/notification.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/notification.ex
b/lib/pleroma/notification.ex
index a98649b6375bb1c9227c1e4246f88f3e66532fae..ef8e0b4c163b1a9e4d47e51656eaf9148de4a14f 100644
(file)
--- a/
lib/pleroma/notification.ex
+++ b/
lib/pleroma/notification.ex
@@
-7,6
+7,7
@@
defmodule Pleroma.Notification do
alias Pleroma.Activity
alias Pleroma.Notification
+ alias Pleroma.Object
alias Pleroma.Pagination
alias Pleroma.Repo
alias Pleroma.User
@@
-33,7
+34,10
@@
defmodule Pleroma.Notification do
Notification
|> where(user_id: ^user.id)
|> join(:inner, [n], activity in assoc(n, :activity))
- |> preload(: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})
end
def for_user(user, opts \\ %{}) do