projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make search provider configurable
[akkoma]
/
lib
/
pleroma
/
chat.ex
diff --git
a/lib/pleroma/chat.ex
b/lib/pleroma/chat.ex
index 202fffb8adf0d968271fe4401e035b464c06b5bc..bacff24b59480d2e3faefb74321cd6f7a78b5dcf 100644
(file)
--- a/
lib/pleroma/chat.ex
+++ b/
lib/pleroma/chat.ex
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-202
0
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-202
1
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Chat do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Chat do
@@
-8,6
+8,7
@@
defmodule Pleroma.Chat do
import Ecto.Changeset
import Ecto.Query
import Ecto.Changeset
import Ecto.Query
+ alias Pleroma.Chat
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Repo
alias Pleroma.User
@@
-85,4
+86,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