```
The recipient of messages that are sent to this chat is given by their AP ID.
-The usual pagination options are implemented.
+No pagination is implemented for now.
### Getting the messages for a Chat
end
end
- def index(%{assigns: %{user: %{id: user_id} = user}} = conn, params) do
+ def index(%{assigns: %{user: %{id: user_id} = user}} = conn, _params) do
blocked_ap_ids = User.blocked_users_ap_ids(user)
chats =
where: c.recipient not in ^blocked_ap_ids,
order_by: [desc: c.updated_at]
)
- |> Pagination.fetch_paginated(params |> stringify_keys)
+ |> Repo.all()
conn
|> put_view(ChatView)
assert length(result) == 0
end
- test "it paginates", %{conn: conn, user: user} do
+ test "it returns all chats", %{conn: conn, user: user} do
Enum.each(1..30, fn _ ->
recipient = insert(:user)
{:ok, _} = Chat.get_or_create(user.id, recipient.ap_id)
|> get("/api/v1/pleroma/chats")
|> json_response_and_validate_schema(200)
- assert length(result) == 20
-
- result =
- conn
- |> get("/api/v1/pleroma/chats?max_id=#{List.last(result)["id"]}")
- |> json_response_and_validate_schema(200)
-
- assert length(result) == 10
+ assert length(result) == 30
end
test "it return a list of chats the current user is participating in, in descending order of updates",