aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-06-03 12:56:39 +0200
committerlain <lain@soykaf.club>2020-06-03 12:56:39 +0200
commit2591745fc2417771f96340ed3f36177c0da194c3 (patch)
tree029508909f1cc56750b5afd8cedb94c5b84fe166 /lib
parentf3ccd50a33c9eec3661bf2116fe38542f04986aa (diff)
downloadpleroma-2591745fc2417771f96340ed3f36177c0da194c3.tar.gz
ChatMessageReferences: Move tests
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/chat.ex34
1 files changed, 0 insertions, 34 deletions
diff --git a/lib/pleroma/chat.ex b/lib/pleroma/chat.ex
index 211b872f9..65938c7a4 100644
--- a/lib/pleroma/chat.ex
+++ b/lib/pleroma/chat.ex
@@ -6,9 +6,7 @@ defmodule Pleroma.Chat do
use Ecto.Schema
import Ecto.Changeset
- import Ecto.Query
- alias Pleroma.Object
alias Pleroma.Repo
alias Pleroma.User
@@ -26,38 +24,6 @@ defmodule Pleroma.Chat do
timestamps()
end
- def last_message_for_chat(chat) do
- messages_for_chat_query(chat)
- |> order_by(desc: :id)
- |> limit(1)
- |> Repo.one()
- end
-
- def messages_for_chat_query(chat) do
- chat =
- chat
- |> Repo.preload(:user)
-
- from(o in Object,
- where: fragment("?->>'type' = ?", o.data, "ChatMessage"),
- where:
- fragment(
- """
- (?->>'actor' = ? and ?->'to' = ?)
- OR (?->>'actor' = ? and ?->'to' = ?)
- """,
- o.data,
- ^chat.user.ap_id,
- o.data,
- ^[chat.recipient],
- o.data,
- ^chat.recipient,
- o.data,
- ^[chat.user.ap_id]
- )
- )
- end
-
def creation_cng(struct, params) do
struct
|> cast(params, [:user_id, :recipient, :unread])