projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
User search: Remove trigram and refactor the module
[akkoma]
/
lib
/
pleroma
/
notification.ex
diff --git
a/lib/pleroma/notification.ex
b/lib/pleroma/notification.ex
index d7e23299223728325a9cd8d3911d138eb3ea46d0..d94ae5971c5a7e8159ed3361d8bdcd402f43ea14 100644
(file)
--- a/
lib/pleroma/notification.ex
+++ b/
lib/pleroma/notification.ex
@@
-22,8
+22,8
@@
defmodule Pleroma.Notification do
schema "notifications" do
field(:seen, :boolean, default: false)
schema "notifications" do
field(:seen, :boolean, default: false)
- belongs_to(:user, User, type:
Pleroma.FlakeId
)
- belongs_to(:activity, Activity, type:
Pleroma.FlakeId
)
+ belongs_to(:user, User, type:
FlakeId.Ecto.CompatType
)
+ belongs_to(:activity, Activity, type:
FlakeId.Ecto.CompatType
)
timestamps()
end
timestamps()
end
@@
-116,7
+116,8
@@
defmodule Pleroma.Notification do
{_, notification_ids} = Repo.update_all(query, [])
{_, notification_ids} = Repo.update_all(query, [])
- from(n in Notification, where: n.id in ^notification_ids)
+ Notification
+ |> where([n], n.id in ^notification_ids)
|> join(:inner, [n], activity in assoc(n, :activity))
|> join(:left, [n, a], object in Object,
on:
|> join(:inner, [n], activity in assoc(n, :activity))
|> join(:left, [n, a], object in Object,
on:
@@
-209,8
+210,10
@@
defmodule Pleroma.Notification do
unless skip?(activity, user) do
notification = %Notification{user_id: user.id, activity: activity}
{:ok, notification} = Repo.insert(notification)
unless skip?(activity, user) do
notification = %Notification{user_id: user.id, activity: activity}
{:ok, notification} = Repo.insert(notification)
- Streamer.stream("user", notification)
- Streamer.stream("user:notification", notification)
+
+ ["user", "user:notification"]
+ |> Streamer.stream(notification)
+
Push.send(notification)
notification
end
Push.send(notification)
notification
end