Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into issue/2115

This commit is contained in:
lain 2020-09-22 17:13:46 +02:00
commit c95859e45b
254 changed files with 7057 additions and 8966 deletions

View file

@ -8,6 +8,7 @@ defmodule Pleroma.Chat do
import Ecto.Changeset
import Ecto.Query
alias Pleroma.Chat
alias Pleroma.Repo
alias Pleroma.User
@ -85,4 +86,12 @@ defmodule Pleroma.Chat do
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