diff options
author | lain <lain@soykaf.club> | 2020-11-04 13:48:15 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-11-04 13:48:15 +0000 |
commit | bc4d9c4ffc9ccd826220893a97ce695e4bb66f9d (patch) | |
tree | d3218f11c1d85b9dc32e8eae9054f2a7551ae6bb /test | |
parent | ba3f3a5a56d4a5ac05443fd30b5864778ad1131e (diff) | |
parent | ca95cbe0b48b6c64e6e33addf79e4d212d5f9872 (diff) | |
download | pleroma-bc4d9c4ffc9ccd826220893a97ce695e4bb66f9d.tar.gz pleroma-bc4d9c4ffc9ccd826220893a97ce695e4bb66f9d.zip |
Merge branch 'hide-muted-chats' into 'develop'
Hide chats from muted users
Closes #2230
See merge request pleroma/pleroma!3116
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs index fa6b9db65..c1e6a8cc5 100644 --- a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs @@ -343,6 +343,35 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do assert length(result) == 0 end + test "it does not return chats with users you muted", %{conn: conn, user: user} do + recipient = insert(:user) + + {:ok, _} = Chat.get_or_create(user.id, recipient.ap_id) + + result = + conn + |> get("/api/v1/pleroma/chats") + |> json_response_and_validate_schema(200) + + assert length(result) == 1 + + User.mute(user, recipient) + + result = + conn + |> get("/api/v1/pleroma/chats") + |> json_response_and_validate_schema(200) + + assert length(result) == 0 + + result = + conn + |> get("/api/v1/pleroma/chats?with_muted=true") + |> json_response_and_validate_schema(200) + + assert length(result) == 1 + end + test "it returns all chats", %{conn: conn, user: user} do Enum.each(1..30, fn _ -> recipient = insert(:user) |