forked from AkkomaGang/akkoma
Add actor to recipients
This commit is contained in:
parent
9a444c0d22
commit
e116e55cab
2 changed files with 18 additions and 0 deletions
|
@ -36,6 +36,14 @@ defp get_recipients(%{"type" => "Announce"} = data) do
|
||||||
{recipients, to, cc}
|
{recipients, to, cc}
|
||||||
end
|
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
|
defp get_recipients(data) do
|
||||||
to = data["to"] || []
|
to = data["to"] || []
|
||||||
cc = data["cc"] || []
|
cc = data["cc"] || []
|
||||||
|
|
|
@ -181,6 +181,16 @@ test "direct timeline", %{conn: conn} do
|
||||||
assert %{"visibility" => "direct"} = status
|
assert %{"visibility" => "direct"} = status
|
||||||
assert status["url"] != direct.data["id"]
|
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
|
# Both should be visible here
|
||||||
res_conn =
|
res_conn =
|
||||||
conn
|
conn
|
||||||
|
|
Loading…
Reference in a new issue