diff options
author | Maxim Filippov <colixer@gmail.com> | 2019-01-18 22:40:52 +0300 |
---|---|---|
committer | Maxim Filippov <colixer@gmail.com> | 2019-01-18 22:40:52 +0300 |
commit | e116e55cabb34d468866231d1690421792c27a0c (patch) | |
tree | a2177c938c2d139b5f0e8859737e6d46719fcde8 | |
parent | 9a444c0d22fc935c0e268c10d32c847125fd3627 (diff) | |
download | pleroma-e116e55cabb34d468866231d1690421792c27a0c.tar.gz |
Add actor to recipients
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 8 | ||||
-rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 5b87f7462..487d4c84a 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -36,6 +36,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do {recipients, to, cc} end + defp get_recipients(%{"type" => "Create"} = data) do + to = data["to"] || [] + cc = data["cc"] || [] + actor = data["actor"] || [] + recipients = (to ++ cc ++ [actor]) |> Enum.uniq() + {recipients, to, cc} + end + defp get_recipients(data) do to = data["to"] || [] cc = data["cc"] || [] diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index fe8f845c7..ce3aa5a02 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -181,6 +181,16 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do assert %{"visibility" => "direct"} = status assert status["url"] != direct.data["id"] + # User should be able to see his own direct message + res_conn = + build_conn() + |> assign(:user, user_one) + |> get("api/v1/timelines/direct") + + [status] = json_response(res_conn, 200) + + assert %{"visibility" => "direct"} = status + # Both should be visible here res_conn = conn |