diff options
author | lain <lain@soykaf.club> | 2020-11-03 13:11:36 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-11-03 13:11:36 +0000 |
commit | f7a3dcd3200bd6072d61ca51e91d5a2a75a9ffe7 (patch) | |
tree | 5e2e3767cce93218ae162bd564673d830f2d3e1b /test | |
parent | 0d8cc0905aeebb965df0cf755a171d21b01ed978 (diff) | |
parent | c37118e6f26f0305d540047e4ccb8d594d2c0e6b (diff) | |
download | pleroma-f7a3dcd3200bd6072d61ca51e91d5a2a75a9ffe7.tar.gz pleroma-f7a3dcd3200bd6072d61ca51e91d5a2a75a9ffe7.zip |
Merge branch 'patch-4' into 'develop'
ConversationView: add current user to conversations, according to Mastodon behaviour, fix last_status.account being not filled
Closes #2217
See merge request pleroma/pleroma!3089
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs | 21 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/views/conversation_view_test.exs | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs index b23b22752..c67e584dd 100644 --- a/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs @@ -55,14 +55,35 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do account_ids = Enum.map(res_accounts, & &1["id"]) assert length(res_accounts) == 2 + assert user_one.id not in account_ids assert user_two.id in account_ids assert user_three.id in account_ids assert is_binary(res_id) assert unread == false assert res_last_status["id"] == direct.id + assert res_last_status["account"]["id"] == user_one.id assert Participation.unread_count(user_one) == 0 end + test "includes the user if the user is the only participant", %{ + user: user_one, + conn: conn + } do + {:ok, _direct} = create_direct_message(user_one, []) + + res_conn = get(conn, "/api/v1/conversations") + + assert response = json_response_and_validate_schema(res_conn, 200) + + assert [ + %{ + "accounts" => [account] + } + ] = response + + assert user_one.id == account["id"] + end + test "observes limit params", %{ user: user_one, user_two: user_two, diff --git a/test/pleroma/web/mastodon_api/views/conversation_view_test.exs b/test/pleroma/web/mastodon_api/views/conversation_view_test.exs index 2e8203c9b..20c10ba3d 100644 --- a/test/pleroma/web/mastodon_api/views/conversation_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/conversation_view_test.exs @@ -36,9 +36,11 @@ defmodule Pleroma.Web.MastodonAPI.ConversationViewTest do assert conversation.id == participation.id |> to_string() assert conversation.last_status.id == activity.id + assert conversation.last_status.account.id == user.id assert [account] = conversation.accounts assert account.id == other_user.id + assert conversation.last_status.pleroma.direct_conversation_id == participation.id end end |