projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
FedSockets: fix log spam on cached rejects
[akkoma]
/
lib
/
pleroma
/
chat.ex
diff --git
a/lib/pleroma/chat.ex
b/lib/pleroma/chat.ex
index 24a86371e7801594caa18acc33b7b9eb999f73b6..84f8806a084c1ad957bc477af6d6b3ac8c88fd7f 100644
(file)
--- a/
lib/pleroma/chat.ex
+++ b/
lib/pleroma/chat.ex
@@
-6,7
+6,9
@@
defmodule Pleroma.Chat do
use Ecto.Schema
import Ecto.Changeset
use Ecto.Schema
import Ecto.Changeset
+ import Ecto.Query
+ alias Pleroma.Chat
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Repo
alias Pleroma.User
@@
-69,4
+71,12
@@
defmodule Pleroma.Chat do
conflict_target: [:user_id, :recipient]
)
end
conflict_target: [:user_id, :recipient]
)
end
+
+ @spec for_user_query(FlakeId.Ecto.CompatType.t()) :: Ecto.Query.t()
+ def for_user_query(user_id) do
+ from(c in Chat,
+ where: c.user_id == ^user_id,
+ order_by: [desc: c.updated_at]
+ )
+ end
end
end