aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlambda <lain@soykaf.club>2019-06-03 09:48:37 +0000
committerlambda <lain@soykaf.club>2019-06-03 09:48:37 +0000
commit314758c25bbc0044afcec98710c36532a1dc7e0d (patch)
tree56f737d7ee009acd73726345085b95a89b182191
parente71da4468e8f6e9e4f45a48f6fb266a89eade541 (diff)
parent97fb50d9faaea509e3e7809689f4aa045634fa81 (diff)
downloadpleroma-314758c25bbc0044afcec98710c36532a1dc7e0d.tar.gz
Merge branch 'align-mastodon-conversations' into 'develop'
Mastodon Conversations API: Align to Mastodon behavior See merge request pleroma/pleroma!1215
-rw-r--r--lib/pleroma/web/mastodon_api/views/conversation_view.ex7
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs6
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/conversation_view.ex b/lib/pleroma/web/mastodon_api/views/conversation_view.ex
index 8e8f7cf31..af1dcf66d 100644
--- a/lib/pleroma/web/mastodon_api/views/conversation_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/conversation_view.ex
@@ -22,9 +22,14 @@ defmodule Pleroma.Web.MastodonAPI.ConversationView do
last_status = StatusView.render("status.json", %{activity: activity, for: user})
+ # Conversations return all users except the current user.
+ users =
+ participation.conversation.users
+ |> Enum.reject(&(&1.id == user.id))
+
accounts =
AccountView.render("accounts.json", %{
- users: participation.conversation.users,
+ users: users,
as: :user
})
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index f5f87d8af..9482f4cb8 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -317,12 +317,13 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
test "Conversations", %{conn: conn} do
user_one = insert(:user)
user_two = insert(:user)
+ user_three = insert(:user)
{:ok, user_two} = User.follow(user_two, user_one)
{:ok, direct} =
CommonAPI.post(user_one, %{
- "status" => "Hi @#{user_two.nickname}!",
+ "status" => "Hi @#{user_two.nickname}, @#{user_three.nickname}!",
"visibility" => "direct"
})
@@ -348,7 +349,10 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
}
] = response
+ account_ids = Enum.map(res_accounts, & &1["id"])
assert length(res_accounts) == 2
+ assert user_two.id in account_ids
+ assert user_three.id in account_ids
assert is_binary(res_id)
assert unread == true
assert res_last_status["id"] == direct.id