forked from AkkomaGang/akkoma
ChatController: Remove nonsensical pagination.
This commit is contained in:
parent
7d66dd180a
commit
89b85f6529
3 changed files with 5 additions and 12 deletions
|
@ -135,7 +135,7 @@ Returned data:
|
||||||
```
|
```
|
||||||
|
|
||||||
The recipient of messages that are sent to this chat is given by their AP ID.
|
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
|
### Getting the messages for a Chat
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ def messages(%{assigns: %{user: %{id: user_id} = user}} = conn, %{id: id} = para
|
||||||
end
|
end
|
||||||
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)
|
blocked_ap_ids = User.blocked_users_ap_ids(user)
|
||||||
|
|
||||||
chats =
|
chats =
|
||||||
|
@ -149,7 +149,7 @@ def index(%{assigns: %{user: %{id: user_id} = user}} = conn, params) do
|
||||||
where: c.recipient not in ^blocked_ap_ids,
|
where: c.recipient not in ^blocked_ap_ids,
|
||||||
order_by: [desc: c.updated_at]
|
order_by: [desc: c.updated_at]
|
||||||
)
|
)
|
||||||
|> Pagination.fetch_paginated(params |> stringify_keys)
|
|> Repo.all()
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_view(ChatView)
|
|> put_view(ChatView)
|
||||||
|
|
|
@ -289,7 +289,7 @@ test "it does not return chats with users you blocked", %{conn: conn, user: user
|
||||||
assert length(result) == 0
|
assert length(result) == 0
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it paginates", %{conn: conn, user: user} do
|
test "it returns all chats", %{conn: conn, user: user} do
|
||||||
Enum.each(1..30, fn _ ->
|
Enum.each(1..30, fn _ ->
|
||||||
recipient = insert(:user)
|
recipient = insert(:user)
|
||||||
{:ok, _} = Chat.get_or_create(user.id, recipient.ap_id)
|
{:ok, _} = Chat.get_or_create(user.id, recipient.ap_id)
|
||||||
|
@ -300,14 +300,7 @@ test "it paginates", %{conn: conn, user: user} do
|
||||||
|> get("/api/v1/pleroma/chats")
|
|> get("/api/v1/pleroma/chats")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert length(result) == 20
|
assert length(result) == 30
|
||||||
|
|
||||||
result =
|
|
||||||
conn
|
|
||||||
|> get("/api/v1/pleroma/chats?max_id=#{List.last(result)["id"]}")
|
|
||||||
|> json_response_and_validate_schema(200)
|
|
||||||
|
|
||||||
assert length(result) == 10
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it return a list of chats the current user is participating in, in descending order of updates",
|
test "it return a list of chats the current user is participating in, in descending order of updates",
|
||||||
|
|
Loading…
Reference in a new issue